roles and non-relative dirs

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

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!