The standard AWX deployment comes with a standard Python virtual environment with some pre-installed python modules. These default modules are suitable if you use only the default Ansible playbooks. If you want to use custom Python modules you usually need more than the default set Python Modules.
Changing the default modules with hacking the default containers, is not the way to go in a dynamic Kubernetes deployment. Luckily they created a simpler way to archive this. This is only possible if you deploy your AWX Instances with the default install playbooks provided in the official AWX git repo. You can safely run this command against your running AWX instances. It just redeploy your running containers with custom venvs.
Add the parameter “–extra-vars” to your install play, like this:
1 |
ansible-playbook -i inventory install.yml --extra-vars '@venv_vars.yaml' |
In this venv_vars.yaml it is possible to define custom venvs with other installed Python modules. The structure can look like this example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# venv_vars.yaml --- custom_venvs: - name: zeep python: python3 # Defaults to python2 python_ansible_version: 2.9.7 python_modules: - zeep - name: vmware python: python3 python_ansible_version: 2.9.7 python_modules: - pyvmomi |
After the deployment you also need to add your custom venvs path to AWX, like described in THIS post.
so if awx is installed via operator in kubernetes, https://github.com/ansible/awx-operator coz starting in version 18.0, the AWX Operator is the preferred way to install AWX, then you can’t change the set of modules in any way? hmm … then this is not needed for nothing awx