# publishing custom modules, and module dependencies in roles

**URL:** <https://forum.ansible.com/t/publishing-custom-modules-and-module-dependencies-in-roles/21001>\
**Category:** Ansible Project\
**Tags:** galaxy-ng\
**Created:** [March 28, 2016, 4:43pm UTC](https://forum.ansible.com/t/publishing-custom-modules-and-module-dependencies-in-roles/21001 "2016-03-28T16:43:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charlie\_DeTar](https://avatars.discourse-cdn.com/v4/letter/c/90ced4/32.png) [@Charlie\_DeTar](https://forum.ansible.com/u/Charlie_DeTar)\
**Post date:** [March 28, 2016, 4:43pm UTC](https://forum.ansible.com/t/publishing-custom-modules-and-module-dependencies-in-roles/21001/1 "2016-03-28T16:43:38Z")

</div>

Hi,

I’m trying to figure out if I can publish a custom module, and roles that depend on it. The [developing modules](https://docs.ansible.com/ansible/developing_modules.htm) docs talk about setting ANSIBLE\_LIBRARY environment variable for pointing to where a module exists, and [ansible.cfg’s `library`](https://docs.ansible.com/ansible/intro_configuration.html#library) can set a path, and then there’s the `./library` folder within a playbook. But all of those controls are at the playbook level, not at the role level.

I can’t figure out how to indicate that a role depends on a particular custom module, and next, how to publish that role in a way that brings the custom module with it to e.g. Ansible Galaxy. I see that roles can express dependencies on other roles – which would be great, I could write a “wrapper” role around the module so it could function as a role dependency – but I’d have to first get the module to ship with the role.

Is there any way to ship a module along with a role? Or short of that, some way to declare a remote module dependency within a role? Or am I stuck with requiring every playbook that uses a role with a custom module dependency to micromanage the paths to those libraries?

best,  
Charlie

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [March 28, 2016, 4:59pm UTC](https://forum.ansible.com/t/publishing-custom-modules-and-module-dependencies-in-roles/21001/2 "2016-03-28T16:59:09Z")

</div>

Create a library dir inside the role, put modules there

This works now for all kind of plugins, callback\_plugins/, filter\_plugins/, etc
