# using modules in library folder from galaxy installed role

**URL:** <https://forum.ansible.com/t/using-modules-in-library-folder-from-galaxy-installed-role/31829>\
**Category:** AWX Project\
**Tags:** awx, galaxy-ng\
**Created:** [December 16, 2019, 8:15pm UTC](https://forum.ansible.com/t/using-modules-in-library-folder-from-galaxy-installed-role/31829 "2019-12-16T20:15:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tiemen\_Ruiten](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@Tiemen\_Ruiten](https://forum.ansible.com/u/Tiemen_Ruiten)\
**Post date:** [December 16, 2019, 8:15pm UTC](https://forum.ansible.com/t/using-modules-in-library-folder-from-galaxy-installed-role/31829/1 "2019-12-16T20:15:28Z")

</div>

Hello,

I’m a beginner with AWX. I’m trying to use [pcs-modules-2](https://github.com/OndrejHome/ansible.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?

Thanks,

---

<div class="post-metadata">

**Author:** ![john.westcott.iv](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/john.westcott.iv/32/95_2.png) [@john.westcott.iv](https://forum.ansible.com/u/john.westcott.iv)\
**Post date:** [December 16, 2019, 10:16pm UTC](https://forum.ansible.com/t/using-modules-in-library-folder-from-galaxy-installed-role/31829/2 "2019-12-16T22:16:34Z")

</div>

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?

-John

---

<div class="post-metadata">

**Author:** ![Tiemen\_Ruiten](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@Tiemen\_Ruiten](https://forum.ansible.com/u/Tiemen_Ruiten)\
**Post date:** [December 17, 2019, 10:15am UTC](https://forum.ansible.com/t/using-modules-in-library-folder-from-galaxy-installed-role/31829/3 "2019-12-17T10:15:06Z")

</div>

Hello,

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:

- hosts: all  
gather\_facts: false  
tasks:

- block:  
#- name: detect requirements.yml

# stat: path={{project\_path|quote}}/roles/requirements.yml

# register: doesRequirementsExist

- name: fetch galaxy roles from requirements.yml  
command: ansible-galaxy install -r requirements.yml -p {{roles\_destination|default(‘.’)|quote}}{{ ’ -’ + ‘v’ \* ansible\_verbosity if ansible\_verbosity else ‘’ }}  
args:  
chdir: “{{project\_path|quote}}/roles”  
register: galaxy\_result  
#when: doesRequirementsExist.stat.exists  
changed\_when: “‘was installed successfully’ in galaxy\_result.stdout”  
environment:  
ANSIBLE\_FORCE\_COLOR: False

#when: roles\_enabled|bool  
delegate\_to: localhost

All roles are now in the project directory, /var/lib/awx/projects/\_9\_\_endpoints/roles, I believe that’s correct.

Unfortunately it didn’t make a difference for the job:

ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.

The playbook until the task triggering that error:

---

<div class="post-metadata">

**Author:** ![Tiemen\_Ruiten](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@Tiemen\_Ruiten](https://forum.ansible.com/u/Tiemen_Ruiten)\
**Post date:** [December 18, 2019, 1:10pm UTC](https://forum.ansible.com/t/using-modules-in-library-folder-from-galaxy-installed-role/31829/4 "2019-12-18T13:10:09Z")

</div>

Does anyone have any ideas? Should I file one or more bugs for this?

---

<div class="post-metadata">

**Author:** ![AlanCoding](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/alancoding/32/301_2.png) [@AlanCoding](https://forum.ansible.com/u/AlanCoding)\
**Post date:** [December 18, 2019, 2:42pm UTC](https://forum.ansible.com/t/using-modules-in-library-folder-from-galaxy-installed-role/31829/5 "2019-12-18T14:42:31Z")

</div>

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”.

---

<div class="post-metadata">

**Author:** ![Tiemen\_Ruiten](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@Tiemen\_Ruiten](https://forum.ansible.com/u/Tiemen_Ruiten)\
**Post date:** [December 18, 2019, 3:52pm UTC](https://forum.ansible.com/t/using-modules-in-library-folder-from-galaxy-installed-role/31829/6 "2019-12-18T15:52:37Z")

</div>

Hello

> Are you on the latest version of AWX?

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

This is the tree structure of that role:

ondrejhome.pcs-modules-2  
│ ├── library  
│ │ ├── detect\_pacemaker\_cluster.py  
│ │ ├── pcs\_auth.py  
│ │ ├── pcs\_cluster.py  
│ │ ├── pcs\_constraint\_colocation.py  
│ │ ├── pcs\_constraint\_location.py  
│ │ ├── pcs\_constraint\_order.py  
│ │ ├── pcs\_property.py  
│ │ ├── pcs\_resource\_defaults.py  
│ │ └── pcs\_resource.py  
│ ├── LICENSE  
│ ├── LICENSE-APACHE2.txt  
│ ├── LICENSE-GPLv3.txt  
│ ├── meta  
│ │ └── main.yml  
│ ├── README.md  
│ └── tests  
│ ├── inventory  
│ └── test.yml

I still get “ERROR! no action detected in task.” on the first task referencing one of those modules.

---

<div class="post-metadata">

**Author:** ![AlanCoding](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/alancoding/32/301_2.png) [@AlanCoding](https://forum.ansible.com/u/AlanCoding)\
**Post date:** [December 18, 2019, 5:11pm UTC](https://forum.ansible.com/t/using-modules-in-library-folder-from-galaxy-installed-role/31829/7 "2019-12-18T17:11:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Tiemen\_Ruiten](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@Tiemen\_Ruiten](https://forum.ansible.com/u/Tiemen_Ruiten)\
**Post date:** [December 18, 2019, 7:32pm UTC](https://forum.ansible.com/t/using-modules-in-library-folder-from-galaxy-installed-role/31829/8 "2019-12-18T19:32:07Z")

</div>

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.
