Set custom virtual environments and Ansible versions in Tower

Tower 3.3 introduced the ability to have multiple versions of Ansible availble, this can be really useful if we have custom python packages needed with dependencies we dont want to upgrade, or we want a specific version of Ansible being run to combat anything deprecated.

1.) SSH into the tower instance and then as root run the following

virtualenv /var/lib/awx/venv/'custom_name'

the custom_name needs to be something to assist you with the version if you want it for a specific ansible version then use something like ansible2_6 etc

For this purpose I will create 2 one for ansible 2_6 and another for latest ansible but to use the F5 SDK as I dont want to touch the core ansible virtual environment for my custom stuff.

ansible2_6 will be

ansible_f5 will be

2.) We need to install some core packages being python-memcached psutil

We need to run pip from the respected virtual environments like so

/var/lib/awx/venv/'custom_name'/bin/pip install python-memcached psutil 


3.) Now we can go ahead and install our custom packages for the Ansible 2.6 I want to ensure Ansible version 2.6 is installed so I can run the following

/var/lib/awx/venv/ansible2_6/bin/pip install -U ansible==2.6

For the F5 one I want the latest ansible and the f5 sdk

/var/lib/awx/venv/ansible_f5/bin/pip install -U ansible f5-sdk

4.) Now we have 2 additional virtual environments and Tower will see them

Now when I log into tower and go to my job templates I can select the virtual environment like so

The /var/lib/awx/venv/ansible is the default Tower environment this one gets modified when you update Tower the other 2 are our custom ones that we control.

Leave a Reply

Your email address will not be published. Required fields are marked *