Roles directory not found anymore in Ansible 2

Hi!

I started using Ansible with 1.9 and soon upgraded to a pre-release version of 2.0.0. Today, I upgraded to 2.0.0.2 and Ansible no longer finds my roles directory.

My directory hierarchy looks like this:

ansible/
production
roles/

foo/

bar/

services/
x/
main.yml (playbook, uses roles foo and bar)

When I want to configure service x, I run:

ansible-playbook -i production services/x/main.yml

The problem after upgrade is that Ansible doesn’t find the roles directory anymore. It searches services/x/roles/foo and services/x/foo, while in the past it searched roles/foo.

I couldn’t get it to search any more directories by setting roles_path in ansible.cfg’s [default] section. Also, this would only be an option for my use case if it supported paths relative to the directory where ansible.cfg resides in (I’m not sure whether it does); Other users have the playbooks repo in another directory on their machines.

Assuming I’ll have tens of services in the future, I’d really like to store the service specific playbooks in a separate directory and not at the top level. Any ideas how to achieve this?

Petri Lehtinen

I’m unsure about a change in the search paths, however on a slightly different topic, the section in ansible.cfg is [defaults] with an ‘s’. You indicated using ‘default’ without an ‘s’ which could be why setting roles_path didn’t work.

Ah, setting roles_path = roles in the correct section did the trick. Thanks a lot!

Petri