# Specify roles directory?

**URL:** <https://forum.ansible.com/t/specify-roles-directory/15321>\
**Category:** Ansible Project\
**Created:** [May 23, 2014, 8:05pm UTC](https://forum.ansible.com/t/specify-roles-directory/15321 "2014-05-23T20:05:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Harris](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@Jason\_Harris](https://forum.ansible.com/u/Jason_Harris)\
**Post date:** [May 23, 2014, 8:05pm UTC](https://forum.ansible.com/t/specify-roles-directory/15321/1 "2014-05-23T20:05:29Z")

</div>

Hi All,

Maybe there is already a setting for this and I am just missing it…

With the ansible-playbook command line how do I specify the directory to use for the roles?

Right now I have things set up sort of like follows:

ourhosts.ini  
ourvariables.yml  
deploy\_nyc.yml  
deploy\_ams.yml  
deploy\_sgp.yml

roles/  
common/

webtier/  
monitoring/  
fooapp/

Inside each of our deploy\_nyc.yml files we target different hosts with different roles etc. In order not to have to remember many of the details of each of the scripts we might turn around and have lots of these scripts. Eg

deploy\_blogsite\_nyc.yml  
deploy\_fullmonitoring\_sgp.yml,  
etc.

In that way we just tweak these scripts with the hosts and tags and roles etc we want… But to do this I would like to be able to have the structure:

ourhosts.ini  
ourvariables.yml  
deploy/  
deploy\_nyc.wml

deploy\_ams.yml

deploy\_sgp.yml

roles/  
common/

webtier/  
monitoring/  
fooapp/

And then I would like to be able to open up a command line and go something like:

cd deploy  
ansible-playbook --inventory-file=“…/outhosts.ini” --extra-vars=“…/ourvariables.yml” --roles-directory=“…/roles” deploy\_nyc.yml

but --roles-directory doesn’t exist. Does some other thing exist to do this? If not is this a reasonable thing to add?

Thanks!  
Jason

---

<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:** [May 23, 2014, 9:31pm UTC](https://forum.ansible.com/t/specify-roles-directory/15321/2 "2014-05-23T21:31:52Z")

</div>

You can include roles from arbitrary paths by including the full path in  
the role as follows:

roles:  
&nbsp;&nbsp;- { role: /path/to/my/role }  
&nbsp;&nbsp;- { role: /different/path/to/another/role }

etc.

When using the ansible-galaxy, it by default will save roles in the path  
defined in your ansible.cfg by the variable "roles\_path" (which defaults to  
/etc/ansible/roles), however that is not used when the plabook looks up the  
role.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [May 25, 2014, 8:51pm UTC](https://forum.ansible.com/t/specify-roles-directory/15321/3 "2014-05-25T20:51:18Z")

</div>

There’s also a roles search path that’s configurable in ansible.cfg.

[http://docs.ansible.com/intro\_configuration.html#roles-path](http://docs.ansible.com/intro_configuration.html#roles-path)
