How to configure requirements in AWX

Hello,

I’ve just setup an AWX installation and connected it to my private GIT repo. So far, everything’s ok, but it seems that AWX doesn’t honour my requiremens.yml which I’ve put in my /roles directory as described in the docs.
Maybe that’s the wrong location, or am I using the wrong syntax? Here’s the content of /role/requirements.yml:

=================/snip/============
collections:

=================/snap/============

The output of the project update shows that no requirements are loaded:

=================/snip/============

PLAY [Update source tree if necessary] *****************************************

TASK [Update project using git] ************************************************
changed: [localhost]

TASK [Set the git repository version] ******************************************
ok: [localhost]

TASK [Repository Version] ******************************************************
ok: [localhost] => {
“msg”: “Repository Version f72348b3f70066d215ccc6a0b186bfb17fddfad1”
}

PLAY [Perform project signature/checksum verification] *************************

PLAY [Install content with ansible-galaxy command if necessary] ****************

TASK [Warn about disabled content sync] ****************************************
skipping: [localhost]

TASK [End play due to disabled content sync] ***********************************
skipping: [localhost]

TASK [Fetch galaxy roles from requirements.(yml/yaml)] *************************
ok: [localhost] => (item=/var/lib/awx/projects/_9__git_devrzdo/roles/requirements.yml)

TASK [Fetch galaxy collections from collections/requirements.(yml/yaml)] *******
[WARNING]: Unable to find ‘/var/lib/awx/projects/_9__git_devrzdo/collections’
in expected paths (use -vvvvv to see paths)
skipping: [localhost]

PLAY RECAP *********************************************************************
localhost : ok=4 changed=1 unreachable=0 failed=0 skipped=2 rescued=0 ignored=0
=================/snap/============

And my playbook which uses community.general.redhat_subscription to register with our Foreman fails because of the missing module…

Thanks and best regards from Germany,

Harald

Ah, figured it out myself: the requirements file should be located in /collections. Just moved it there, and voila, it’s working.

Sorry for the spam,

Harald

I think you currently have to have separate requirements.yml files, one in the roles directory for roles, then one in the collections directory for collections. I am hoping that at some point, we can just put it in the top level of the project dir, and run it there, but that isn’t the case currently.

–John

Hello John,

Thanks for your answer, that explains it a bit more. I‘ll keep this in mind if I have to require a role in the future.

Best regards,

Harald

John,

Have you tried it recently? https://github.com/ansible/awx/pull/14081 was merged on July 5th and so should be in releases 22.5.0+.

-The AWX Team