Search code examples
ansibleansible-toweransible-awx

AWX custom virtual environments not showing up


I've been following instructions for setting up custom virtual environments on AWX.

Steps so far:

  1. Created virtualenvs at /var/lib/awx/venv/py2 and /var/lib/awx/venv/py3
  2. Sent authenticated PATCH request to update venv path setting
    • Endpoint: http://localhost:8052/api/v2/settings/system
    • Body: { "CUSTOM_VENV_PATHS": ["/var/lib/awx/venv/"] }

The /api/v2/config endpoint never shows anything but the default virtualenv.

"custom_virtualenvs": [
  "/var/lib/awx/venv/ansible/"
]

Other things I've tried:

  • Restarting the AWX task container
  • Setting CUSTOM_VENV_PATHS = ['/var/lib/awx/venv/'] in /etc/tower/settings.py

What am I missing?

Resources:

https://docs.ansible.com/ansible-tower/latest/html/upgrade-migration-guide/virtualenv.html

https://github.com/ansible/awx/blob/devel/docs/custom_virtualenvs.md

https://github.com/ansible/awx/issues/515


Solution

  • The solution was to add the virtual environments to both the AWX web image and the AWX task image.

    The virtual environments weren't registering because I had only added them to the task image. Once I added them to both the task and web images I was able to use the virtual environments without running the PATCH request or providing any additional configuration. (This is because I put the virtual environments in the default directory /var/lib/awx/venv/).