How to enable and run the job on dynamic inventory hosts which are powered off at the source

Solution Verified - Updated -

Environment

  • Ansible Automation Platform >= 1.2

Issue

  • How to connect and run the jobs on the imported hosts from dynamic inventory VMs which were powered off at the source level. Ansible Tower/Controller skip these hosts as it gets disabled in the inventory and no job is executed at runtime level.

Resolution

  • The disabling of the VMs can be avoided by running the following commands. For example, if the VM's are imported from Azure :

    # echo "AZURE_RM_ENABLED_VALUE = ''" >> /etc/tower/conf.d/custom.py 
    # chown root:awx /etc/tower/conf.d/custom.py && chmod 640 /etc/tower/conf.d/custom.py
    # automation-controller-service restart
    
  • In case if the VMs are imported from VMware console:

    # echo "VMWARE_ENABLED_VALUE= ''" >> /etc/tower/conf.d/custom.py
    # chown root:awx /etc/tower/conf.d/custom.py && chmod 640 /etc/tower/conf.d/custom.py
    # automation-controller-service restart
    

Root Cause

  • When the VM's are imported dynamically from the source, Ansible Tower/Automation Controller automatically disables all the VM’s which are powered off at the source to avoid unwanted job failure.

Diagnostic Steps

  • To determine if a node is enabled or disabled, it can be checked at location /var/lib/awx/venv/awx/lib/python3.8/site-packages/awx/settings/defaults.py

  • For example:

    VMWARE_ENABLED_VAR = 'guest.gueststate'
    VMWARE_ENABLED_VALUE = 'running'
    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments