I’m a beginner with AWX. I’m trying to use pcs-modules-2, a role which is meant to be included as a dependency. It contains a library folder with some custom Ansible modules (pcs_resource.py, pcs_property.py etc.). In a normal ansible-playbook run that references these modules, this works (obviously), but when I try it in AWX, the modules are not found (ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.). Is this supposed to work? Do I need to adjust a setting?
The requirements.yml file should be processed when the project is synced. Can you look at the sync job for the project to see if there were any errors in there?
Thanks for your answer. When I sync the project, the requirements file is not processed, the task is not executed:
TASK [fetch galaxy roles from requirements.yml] ********************************
skipping: [localhost,] => {“changed”: false, “skip_reason”: “Conditional result was False”}
I double-checked and ‘enable role download’ is on in settings → jobs. To test I commented the “when” clause in the task in project_update.yml, but it would hang on the ‘detect requirements.yml’ task. So I commented that task too and it complained about the roles_destination variable not being set. So I set a default value. The final task block that will sync the roles on a project update looks like this:
Are you on the latest version of AWX? Does your project have a file at roles/requirements.yml, relative to the root of the project? Are you looking at the right project update? If you have requirements in your project, then any jobs ran from it should run a sync before the job starts, which links as a green circle next to the name of the project in the UI. The job type for that project update should be “run”.
I just upgraded from 9.0.1 to 9.1.0 and tested again. Same results.
Does your project have a file at roles/requirements.yml, relative to the root of the project?
Yes
Are you looking at the right project update? If you have requirements in your project, then any jobs ran from it should run a sync before the job starts, which links as a green circle next to the name of the project in the UI. The job type for that project update should be “run”.
OK, I see that the role is installed during a job run in /tmp/awx_44_zrvcyiut/requirements_roles/ondrejhome.pcs-modules-2
Then I don’t know quite what is going wrong. Since you reference a public github repository where the role is hosted, you should be able to reduce your content into a minimal reproducer so that you can share your playbook and requirements.yml file contents without exposing any confidential information. I would try to reproduce the error with that, because I’m interested in some better reference cases for SCM roles. Also, Ansible version could be relevant.
I’m sorry, this was user error. It works the same way as in ‘regular’ Ansible: I have to declare the role in the play (roles: - { role: ondrejhome.pcs-modules-2 } ) before I can actuaIly use it. I thought include_role of another role that had pcs-modules-2 as a dependency would allow me to use it in subsequent tasks in the same play. I don’t know how I missed that. Found out when trying to put together the reproducer.