Documentation

7. Using virtualenv with Ansible Tower

Ansible Tower 3.0 uses virtualenv. Virtualenv creates isolated Python environments to avoid problems caused by conflicting dependencies and differing versions. Virtualenv works by simply creating a folder which contains all of the necessary executables and dependencies for a specific version of Python. Ansible Tower creates two virtualenvs during installation–one is used to run Tower, while the other is used to run Ansible. This allows Tower to run in a stable environment, while allowing you to add or update modules to your Ansible Python environment as necessary to run your playbooks.

Note

For more information on virtualenv, see Virtual Environments

7.1. Modifying the virtualenv

Modifying the virtualenv used by Tower is unsupported and not recommended. Instead, you can add modules to the virtualenv that Tower uses to run Ansible.

To do so, activate the Ansible virtualenv:

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

...and then install whatever you need using pip:

pip install mypackagename

7.2. Tower virtualenv under Red Hat Enterprise Linux 6 and derivatives

Red Hat Enterprise Linux 6 and derivatives (including CentOS 6 and Oracle Linux 6) use Python version 2.6. However, Tower 3.0 requires several components (most notably Django 1.8) that require Python 2.7, so the Python 2.7 software collection is installed with Ansible Tower on these platforms. Note that this is only used to run Tower, not Ansible. Ansible still runs under the system Python 2.6. As a result, the two virtualenvs under /var/lib/awx/venv will each target a different Python interpreter.