# roles and non-relative dirs

**URL:** <https://forum.ansible.com/t/roles-and-non-relative-dirs/12951>\
**Category:** Ansible Project\
**Created:** [June 12, 2013, 5:30pm UTC](https://forum.ansible.com/t/roles-and-non-relative-dirs/12951 "2013-06-12T17:30:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Seth\_Vidal](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@Seth\_Vidal](https://forum.ansible.com/u/Seth_Vidal)\
**Post date:** [June 12, 2013, 5:30pm UTC](https://forum.ansible.com/t/roles-and-non-relative-dirs/12951/1 "2013-06-12T17:30:02Z")

</div>

Our structure is such that I want to refer to roles in non-relative  
dirs.

A canonical absolute path: for files, tasks, etc I defined a global  
vars file that I load that has $files and $tasks etc, defined.

I wanted to do the same thing with $roles so I could do

roles:  
- $roles/somerole

and it would just work no matter what.

the problem is vars\_files are loaded after \_load\_roles() is run - so  
the vars aren't there. If the vars imported from a role are supposed to  
be trumped by the vars\_files in the playbook, that all makes sense -  
but isn't it possible to pull in \_some\_ way of defining a global  
var/path for roles?

After looking at \_load\_roles() I thought I could just define an  
ansible.cfg variable of a roles path so that it would search that path  
(if defined) after using the relative path first, perhaps.

Would that be an acceptable patch?

Thanks  
-sv

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [June 12, 2013, 8:35pm UTC](https://forum.ansible.com/t/roles-and-non-relative-dirs/12951/2 "2013-06-12T20:35:08Z")

</div>

Right, roles are automation that add things to vars\_files and elsewhere, so they happen first.

In this case, I think you could be happy with a “-e roles=path/to/roles”

I kind of like the idea of being able to set -e variables in ansible.cfg, so yes, this would be quite welcome!
