Changing the PATH environment variable inside awx_task container

Hello everyone,

The challenge I’m facing seems quite simple but proves to be quite difficult to solve.
Some roles call some scripts which contain calls to other scripts.
AWX 17.1.0 fails by complaining that it cannot find the recursive scripts with ‘command not found’, although all those scripts are available in the same folder as the top-level calling scripts.

So I’m trying to workaround this issue by:

  • making them all available through a mounted volume inside the container
  • changing the PATH variable of the container to add that folder

For the latter, I’ve tried to build the containers with a modified installer/roles/image_build/templates/Dockerfile.j2 using different strategies :

  • replacing ‘ENV PATH=“/usr/pgsql-10/bin:${PATH}”’ by 'ENV PATH=“<scripts_path>:${PATH}” (/usr/pgsql-10/bin: is useless since it is unreachable)
  • adding ‘RUN echo “export PATH=<scripts_path>:${PATH}” >> /var/lib/awx/.bashrc’
  • adding ‘RUN echo “export PATH=<scripts_path>:${PATH}” >> /root/.bashrc’

Unfortunately, when I examine the PATH used by AWX with a shell ‘env’ command, it is still the same as the default one (with /usr/pgsql-10/bin).

What am I missing?

In case someone wonders, the solution is actually quite simple and involves adding the variable below ‘environment:’ into installer/roles/local_docker/templates/docker-compose.yml.j2.