Ansible & roles_path

So you have some nice roles and a great playbook. Your getting bigger (hence my post, same story) and you want to split up certain parts into say playbooks for “db”, “web”, “app” and such. So you create a folder called playbooks/app/ and have a main.yml in there. Only thing is that you also add a role again in that main.yml. Default behavior of Ansible is to look at the PATH entry’s you have but in my case i don’t want it to look in my path just my local folders in my “roles” directory since i download them locally rather then placing them “globally” which normally requires Root (which i think is not so good way of adding roles because for all we know, you don’t have root) Long story short you need to add something to ansible.cfg. Like the ssh connection options to improve speed, this however had me a bit confused. You can read up on the docs but it doesn’t really say it.

I had this in my ansible.cfg:

[ssh_connection]
pipelining=True

Then i added “roles_path=roles” and nothing happened. Well if you look closely you would notice its underneath the “ssh_connection” part and it would fall under that. I didn’t know you had to add it to [default] for it to work. Perhaps that is the default if you don’t set anything but for me it took some time. So i ended up with:

[ssh_connection]
pipelining=True

[defaults]
roles_path=roles

And that did the trick (assuming you do have all your roles in the “roles” folder)

Riemers