How to configure requirements in AWX

791 views
Skip to first unread message

Harald Husemann

unread,
Aug 15, 2023, 10:07:11 AM8/15/23
to AWX Project
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 <project dir>/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 <project dir>/role/requirements.yml:

=================/snip/============
collections:
  - name: community.general
    source: https://galaxy.ansible.com
=================/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

Harald Husemann

unread,
Aug 15, 2023, 11:11:51 AM8/15/23
to AWX Project
Ah, figured it out myself: the requirements file should be located in <project dir>/collections. Just moved it there, and voila, it's working.

Sorry for the spam,

Harald

John Petro

unread,
Aug 15, 2023, 11:29:53 AM8/15/23
to awx-p...@googlegroups.com
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

--
You received this message because you are subscribed to the Google Groups "AWX Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to awx-project...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/06e22d5d-f012-406b-86d6-6dadd359ec83n%40googlegroups.com.

bof...@gmail.com

unread,
Aug 15, 2023, 11:40:43 AM8/15/23
to awx-p...@googlegroups.com
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 

Von meinem iPhone gesendet

Am 15.08.2023 um 17:29 schrieb John Petro <jcp...@johnpetro.com>:



AWX Project

unread,
Aug 15, 2023, 5:12:39 PM8/15/23
to AWX Project
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

Reply all
Reply to author
Forward
Message has been deleted
0 new messages