# Ansible Tower / AWX and project using roles/requirements.yml

**URL:** <https://forum.ansible.com/t/ansible-tower-awx-and-project-using-roles-requirements-yml/29655>\
**Category:** Ansible Project\
**Tags:** awx, galaxy-ng\
**Created:** [February 12, 2019, 1:18pm UTC](https://forum.ansible.com/t/ansible-tower-awx-and-project-using-roles-requirements-yml/29655 "2019-02-12T13:18:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajfogg](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@ajfogg](https://forum.ansible.com/u/ajfogg)\
**Post date:** [February 12, 2019, 1:18pm UTC](https://forum.ansible.com/t/ansible-tower-awx-and-project-using-roles-requirements-yml/29655/1 "2019-02-12T13:18:37Z")

</div>

Hi all,

I’m trying to figure out a development strategy for my team and how we produce our Ansible output.

We are using Ansible Tower (v3.3.1 but moving to v3.4.1 shortly) and an instance of Github Enterprise to hold our repositories.

I am trying to come up with a workable way of keeping our playbooks and roles separate. My current process is to make one github repo per role, so that anyone on the team can use / contribute to them directly.

I then wished to create a repo that contains all the playbooks, and a roles/requirements.yml, into which we would append new roles to as and when they are needed by any of the playbooks.

This playbooks repo is then loaded into Tower as a project, giving us a single project to source our playbooks from when creating job templates.

Initially, I was hoping I could make sub-directories for the playbooks, so they have their own unique requirements.yml file to stop Tower needing to pull down everything, but it doesn’t appear to allow for this. Going with a top-level roles/requirements.yml is workable, but there is a problem I am yet to figure out how to resolve cleanly.

If I need to make an update to a role, perhaps a task needs changing, but the playbook repo is unaffected, I do not see a way of having Tower re-sync from github all the roles, unless I use the Delete on Update project setting. This bothers me because it seems inefficient having to remove all the local files and then download everything from git again, instead of just having git check what’s different in the repositories specified in the requirements file.

My questions would be:

1. Is there a way to have a project trigger the git / ansible-galaxy check without using the Delete on Update option?
2. Is there a better way of achieving the role / playbook split in Tower than I’ve envisioned above? Our current way is one project per similar set of playbooks, so doing a Delete on Update isn’t too big of an issue as we’re only re-syncing one set of roles and not the whole lot. This works, but it makes the Projects library start to get quite cluttered.

---

<div class="post-metadata">

**Author:** ![Matthew\_Hein](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@Matthew\_Hein](https://forum.ansible.com/u/Matthew_Hein)\
**Post date:** [February 12, 2019, 5:19pm UTC](https://forum.ansible.com/t/ansible-tower-awx-and-project-using-roles-requirements-yml/29655/2 "2019-02-12T17:19:04Z")

</div>

We have been operating using a similar model (single project with single roles/requirements.yml file and multiple individual role repositories referenced in requirements.yml) for at least year without any issues. Prior to Tower 3.3.x, the task to pull down roles in requirements.yml always ran with the –force argument, achieving what you outlined in question #1.

When we migrated from 3.2.5 to 3.3.2, we noticed this changed contradictory to what documentation says ([https://docs.ansible.com/ansible-tower/latest/html/userguide/projects.html#ansible-galaxy-support](https://docs.ansible.com/ansible-tower/latest/html/userguide/projects.html#ansible-galaxy-support)). I opened a support case with Red Hat (02295355) and worked with them on this for several days.

My workaround while working with support to get this functional back is the following was in /var/lib/awx/venv/awx/lib/python2.7/site-packages/awx/playbooks modified the galaxy play in project\_update.yml to have the --force:

- name: fetch galaxy roles from requirements.yml

command: ansible-galaxy install -r requirements.yml -p {{project\_path|quote}}/roles/ --force

args:

chdir: “{{project\_path|quote}}/roles”

register: galaxy\_result

when: doesRequirementsExist.stat.exists and scm\_result is undefined

changed\_when: “‘was installed successfully’ in galaxy\_result.stdout”

Red Hat support suggested to use the project\_update.yml file from Tower 3.2.8 (last 3.2.x release) or add the –force to project\_update.yml since this behavior is from legacy Tower and for the time being will not be changed.

It would be nice if this functionality was brought back or at least made a flag/option.
