install python libs

I am playing around with AWX and want to load a role (or “project” I suppose is the new term) that has some custom libraries and filter_plugins. The problem is that these python scripts require py libs that were never installed in the docker image.

Is there a way to configure an additional PYTHONPATH?

I think I should be able to mount a volume (e.g. /opt/custom-python/libs) into the container and install my python there, then make sure that ever custom role adds sys.path.append(custom_py_path) before the imports.
But … I’d prefer to not have to do that.

any ideas?

thanks,

-MikeB

You could also modify the python requirements files for the image. requirements_ansible is what controls what gets loaded into the ansible virtualenv for use during playbook runs.

Is the “python requirements file” the list of python packages that are installed when the docker image is created? I’m trying not to have a role change to trigger a manual modification and upgrade of AWX.

I assume you’re talking about the ./requirements/requirements_ansible.txt file.

Yep, the very same

sigh. I’m trying really hard to not have to maintain a local custom branch of awx just to set some of these options.

e.g. if I add a project with a playbook that uses the Juniper.junos module, it won’t work unless I also install junos-eznc, meaning I have to either

  1. Modify the container directly: docker exec -it awx_task /bin/pip install junos-eznc. (which may not actually work – haven’t tried)

or

  1. Modify the ./requirements/requirements_ansible.txt file, then remove my awx_task container and re-install it.

Unless there’s something I’m missing.

fwiw, even if #1 worked, modifying non-persistent parts of a running container is also something I am trying to avoid.

where does one find the
/requirements/requirements_ansible.txt ?

In the root of the repo.
https://github.com/ansible/awx/blob/devel/requirements/requirements_ansible.txt