# Feature Poll: Configuration option 'additional\_roles\_path' for common roles

**URL:** <https://forum.ansible.com/t/feature-poll-configuration-option-additional-roles-path-for-common-roles/13563>\
**Category:** Ansible Developer\
**Created:** [September 26, 2013, 10:05pm UTC](https://forum.ansible.com/t/feature-poll-configuration-option-additional-roles-path-for-common-roles/13563 "2013-09-26T22:05:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Omans](https://avatars.discourse-cdn.com/v4/letter/t/b2d939/32.png) [@Thomas\_Omans](https://forum.ansible.com/u/Thomas_Omans)\
**Post date:** [September 26, 2013, 10:05pm UTC](https://forum.ansible.com/t/feature-poll-configuration-option-additional-roles-path-for-common-roles/13563/1 "2013-09-26T22:05:42Z")

</div>

In my usage of roles, I’ve found that I have a collection of project specific roles (db server, deploy webapp, etc) and another class of more common, shared roles (install via tarball, sync through git, etc).

In a given project I want to include both. I have a few choices for how to make this happen:

1. Bundle the common roles with the project in a place ansible automatically looks
2. Reference the roles by path, whether absolute or relative.

My use case is such that I create common roles for a larger development floor, then they become something like end-users who want this stuff to work like a black box.

The first option, bundling, can be made possible with symlinks or git submodules, but in we don’t use git, so submodules are out, and managing symlinks across environments is a bear to maintain, especially across distributed teams.

Because of this I opted for a single repository containing the common roles and a simple bash script that forwards ansible some simple configuration.

I end up using this pattern a lot, and I think the -e flag is a wonderful and flexible feature. It has let me bend ansible to my crazy needs on more than one occasion.

– configured-ansible-playbook.sh  
#!/bin/bash  
source role\_finder.sh  
exec ansible-playbook -e common\_roles=`find_common_roles_path` $@

Then, when you want to use a role you wind up saying:

roles:

- “{{ common\_roles }}”/tarball-installer

And no matter where one of our developers project is ansible is able to find the common role. Alternatively, they can provide their own path to common roles by providing another -e flag.

While this works, I wish I didn’t have the extra step of ‘install my ansible wrapper’ when I tell our devs how to use ansible.

What would make my particular use case (common, project independent roles) more convenient is to have an environment variable / _.ansible.cfg_ option called something along the lines of **additional\_roles\_path** that will search for roles in the provided directories after exhausting the directories it already searches in.

It might look something like this:

[defaults]  
hostfile = /home/thomas/projects/config/ansible-common/scripts/host  
library = /home/thomas/projects/config/ansible-common/library:/usr/share/ansible

```auto

roles_path = /home/thomas/projects/config/ansible-common/roles:/home/thomas/projects/config/ansible-third-party/roles

```

Thoughts?

– Thomas Omans

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 26, 2013, 10:18pm UTC](https://forum.ansible.com/t/feature-poll-configuration-option-additional-roles-path-for-common-roles/13563/2 "2013-09-26T22:18:48Z")

</div>

I’ll accept a roles path, if it does the following:

(A) there is no additional CLI option (it should have an environment option though)  
(B) playbook roles paths continue to be searched as is and this is a fallback path to be used when not found in the other locations.  
(C) it works as follows:

roles:

- { role: foo }

And you don’t have to use the variable like “role\_path” anywhere.

---

<div class="post-metadata">

**Author:** ![Joost\_Cassee](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@Joost\_Cassee](https://forum.ansible.com/u/Joost_Cassee)\
**Post date:** [October 8, 2013, 4:48am UTC](https://forum.ansible.com/t/feature-poll-configuration-option-additional-roles-path-for-common-roles/13563/3 "2013-10-08T04:48:51Z")

</div>

Not sure what the social conventions are / will be concerning “polls” on ansible-devel, but…

+1

Regards,  
Joost
