# Make ansible-playbook accept a roles-path argument?

**URL:** <https://forum.ansible.com/t/make-ansible-playbook-accept-a-roles-path-argument/17482>\
**Category:** Ansible Project\
**Tags:** galaxy-ng\
**Created:** [February 9, 2015, 10:48pm UTC](https://forum.ansible.com/t/make-ansible-playbook-accept-a-roles-path-argument/17482 "2015-02-09T22:48:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Upton](https://avatars.discourse-cdn.com/v4/letter/d/b2d939/32.png) [@Daniel\_Upton](https://forum.ansible.com/u/Daniel_Upton)\
**Post date:** [February 9, 2015, 10:48pm UTC](https://forum.ansible.com/t/make-ansible-playbook-accept-a-roles-path-argument/17482/1 "2015-02-09T22:48:07Z")

</div>

Is it possible to pass the roles\_path parameter (from ansible.cfg) or an equivalent as an argument to ansible-playbook?

My use case is: I’m using the ansible-galaxy (tool not web service) to pull my shared ansible roles from private GitHub repositories into a local directory called “vendor\_roles”, and I’d like ansible playbook to look in this directory too - currently I work around this by symlinking the roles into the roles directory.

I’d also like to share this with the rest of my time without mandating a specific setting in their ansible.cfg file, which can be another barrier to entry / I’d rather give them a Makefile checked into our source control…

If this is not currently possible (browsing the source it doesn’t appear to be) would a pull request to this end likely be accepted?

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [February 10, 2015, 6:27am UTC](https://forum.ansible.com/t/make-ansible-playbook-accept-a-roles-path-argument/17482/2 "2015-02-10T06:27:40Z")

</div>

Hi Daniel, you can use the environment variable ANSIBLE\_ROLES\_PATH=/path/to/roles in front of ansible-playbook to modify the path on the fly, without having to modify your ansible.cfg (or deploy a local cfg in the working directory). In either case, the roles path can be a colon-separated list (just like $PATH) so that it will search multiple paths.

---

<div class="post-metadata">

**Author:** ![Daniel\_Upton](https://avatars.discourse-cdn.com/v4/letter/d/b2d939/32.png) [@Daniel\_Upton](https://forum.ansible.com/u/Daniel_Upton)\
**Post date:** [February 10, 2015, 6:56am UTC](https://forum.ansible.com/t/make-ansible-playbook-accept-a-roles-path-argument/17482/3 "2015-02-10T06:56:49Z")

</div>

Aha! That's perfect - thanks James

---

<div class="post-metadata">

**Author:** ![Tom\_Bamford](https://avatars.discourse-cdn.com/v4/letter/t/c2a13f/32.png) [@Tom\_Bamford](https://forum.ansible.com/u/Tom_Bamford)\
**Post date:** [February 10, 2015, 12:29pm UTC](https://forum.ansible.com/t/make-ansible-playbook-accept-a-roles-path-argument/17482/4 "2015-02-10T12:29:18Z")

</div>

Thanks James, I didn’t know about this. Will come in very handy!

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [February 10, 2015, 1:57pm UTC](https://forum.ansible.com/t/make-ansible-playbook-accept-a-roles-path-argument/17482/5 "2015-02-10T13:57:08Z")

</div>

No problem. By design, every configuration option has a corresponding environment variable you can use, just look in constants.py to see them (they all start with ANSIBLE\_).

---

<div class="post-metadata">

**Author:** ![Jeffrey\_Wen](https://avatars.discourse-cdn.com/v4/letter/j/90db22/32.png) [@Jeffrey\_Wen](https://forum.ansible.com/u/Jeffrey_Wen)\
**Post date:** [November 22, 2016, 6:38pm UTC](https://forum.ansible.com/t/make-ansible-playbook-accept-a-roles-path-argument/17482/6 "2016-11-22T18:38:27Z")

</div>

Hey James,

Your solution for using ANSIBLE\_ROLES\_PATH works! I am having issues trying to find out where the **constants.py** file is that you’re talking about.
