Home / How to test playbook on Ansible Tower nodes from the command line

How to test playbook on Ansible Tower nodes from the command line

Login to the Ansible Tower node and change to awx user.

# sudo su -awx

If you use a custom virtual environment in Ansible Tower, source it as follows.

source /var/lib/awx/venv/ansible/bin/activate

For Ansible or your custom virtual environment, export the Python path used during Ansible Tower task executions.

On the CentOS 7 Server, run as follows.

export PYTHONPATH="/var/lib/awx/venv/ansible/lib/python2.7/site-packages:/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/lib:"

On CentOS 8,

export PYTHONPATH="/var/lib/awx/venv/ansible/lib/python3.6/site-packages:/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/lib:"

Run the playbook using the ansible-playbook command.

You must give any necessary credentials, inventory, and variables to the ansible-playbook command because Ansible Tower’s credentials, inventory, and other parameters won’t be used.

ansible-playbook myplaybook.yml -vvv

Deactivate the Ansible virtual environment as follows.

# deactivate

 

Leave a Reply