# Modify awx\_task container to include new software

**URL:** <https://forum.ansible.com/t/modify-awx-task-container-to-include-new-software/30578>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [June 16, 2019, 1:55pm UTC](https://forum.ansible.com/t/modify-awx-task-container-to-include-new-software/30578 "2019-06-16T13:55:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sergio\_Fernandez](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Sergio\_Fernandez](https://forum.ansible.com/u/Sergio_Fernandez)\
**Post date:** [June 16, 2019, 1:55pm UTC](https://forum.ansible.com/t/modify-awx-task-container-to-include-new-software/30578/1 "2019-06-16T13:55:54Z")

</div>

Hi, I would like to know if you could pinpoint me the exact way to make a software installed in the awx\_task container, so when I run playbooks from AWX using the “delegate\_to: localhost” it gets done successfully.

Currently, I think the Dockerfile is at /opt/awx-install/awx/installer/roles/image\_build/tasks/main.yml  
Do you think that adding in that file new tasks will result in what I am trying to achieve?  
Or is there some particular way to handle this better? I have searched through Google and this forum but no clue, there’s an unanswered question here: [https://groups.google.com/forum/#!searchin/awx-project/awx\_task$20include%7Csort:date/awx-project/mI-X1oCqbiA/02D0LaeWDAAJ](https://groups.google.com/forum/#!searchin/awx-project/awx_task$20include%7Csort:date/awx-project/mI-X1oCqbiA/02D0LaeWDAAJ)

Also there’s a stackoverflow question that doesn’t quite answer what I am searching for: [https://stackoverflow.com/questions/52473962/how-to-enable-changes-in-awx-containers](https://stackoverflow.com/questions/52473962/how-to-enable-changes-in-awx-containers)

Thank you!

---

<div class="post-metadata">

**Author:** ![Uriel](https://avatars.discourse-cdn.com/v4/letter/u/53a042/32.png) [@Uriel](https://forum.ansible.com/u/Uriel)\
**Post date:** [June 17, 2019, 2:47pm UTC](https://forum.ansible.com/t/modify-awx-task-container-to-include-new-software/30578/2 "2019-06-17T14:47:27Z")

</div>

The Dockerfile for the awx-web container is at awx/devel/installer/roles/image\_build/templates/Dockerfile.j2 and the Dockerfile for the awx-task container is at awx/devel/installer/roles/image\_build/templates/Dockerfile.task.j2. If you take a look at the awx-task Dockerfile, you’ll see that all it’s doing is building off the awx-web Dockerfile and removing nginx and launching a different script. Anything the awx-web Dockerfile installs/executes as part of the image is also part of awx-task.

What I’ve been doing is I’ll modify the awx-web Dockerfile with RUN commands to install extra yum packages, pip modules, or ansible virtual envs using Ansible’s lineinfile/blockinfile. Ends up looking similar to below (installs extra yum packages)

lineinfile:  
path: awx/installer/roles/image\_build/templates/Dockerfile.j2  
insertbefore: “USER 1000”  
line: “RUN yum -y install {{ item }}”  
state: present  
loop: “{{ extra\_yum\_packages }}”

---

<div class="post-metadata">

**Author:** ![Sergio\_Fernandez](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Sergio\_Fernandez](https://forum.ansible.com/u/Sergio_Fernandez)\
**Post date:** [June 17, 2019, 8:58pm UTC](https://forum.ansible.com/t/modify-awx-task-container-to-include-new-software/30578/3 "2019-06-17T20:58:32Z")

</div>

Thank you very much, Uriel,

But you said that the awx/devel/installer/roles/image\_build/templates/Dockerfile.task.j2 is the Dockerfile, but in fact is a Jinja2 file…  
I think you mean the file awx/installer/roles/image\_build/tasks/main.yml is the one you have modified? Or which file have you modified?  
Could you more in detail what have you written (or a very simple example) in both files? I apologize for this question, but I think it could clear out a lot of things to the ones that are facing this kind of problem.

Thank you very much again!

---

<div class="post-metadata">

**Author:** ![Uriel](https://avatars.discourse-cdn.com/v4/letter/u/53a042/32.png) [@Uriel](https://forum.ansible.com/u/Uriel)\
**Post date:** [June 17, 2019, 11:00pm UTC](https://forum.ansible.com/t/modify-awx-task-container-to-include-new-software/30578/4 "2019-06-17T23:00:28Z")

</div>

I am in fact modifying the Jinja2 files. A Jinja2 file is nothing more than a text file with special markup – during the installation process, the Jinja2 files are converted to a regular Dockerfile text file and used to build the images. See the following tasks in the main.yml file: [https://github.com/ansible/awx/blob/devel/installer/roles/image\_build/tasks/main.yml#L107](https://github.com/ansible/awx/blob/devel/installer/roles/image_build/tasks/main.yml#L107) and [https://github.com/ansible/awx/blob/devel/installer/roles/image\_build/tasks/main.yml#L113](https://github.com/ansible/awx/blob/devel/installer/roles/image_build/tasks/main.yml#L113).

And the snippet of Ansible code is exactly what I use to install additional yum packages. It’s editing the Dockerfiles to add lines that install yum packages. When the image finally gets built, those commands are run and the final image has those packages ready to go.

---

<div class="post-metadata">

**Author:** ![Cnu\_k](https://avatars.discourse-cdn.com/v4/letter/c/a88e4f/32.png) [@Cnu\_k](https://forum.ansible.com/u/Cnu_k)\
**Post date:** [December 16, 2020, 8:55pm UTC](https://forum.ansible.com/t/modify-awx-task-container-to-include-new-software/30578/5 "2020-12-16T20:55:29Z")

</div>

I tried to install jq and wget by adding following lines to [https://github.com/ansible/awx/blob/devel/installer/roles/image\_build/templates/Dockerfile.j2](https://github.com/ansible/awx/blob/devel/installer/roles/image_build/templates/Dockerfile.j2) after 2nd ‘FROM’ and it’s not working as I don’t see those in awx-web container. Your approach looks similar too, so not sure why adding additional tools wouldn’t work.

Added after ‘ENV PATH=“/usr/pgsql-10/bin:${PATH}”’ line(#244 in above Dockerfile.j2)

RUN dnf install -y jq  
RUN dnf install -y wget
