Roles directory not found anymore in Ansible 2

1,037 views
Skip to first unread message

Petri Lehtinen

unread,
Jan 19, 2016, 8:31:28 AM1/19/16
to Ansible Project
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

Matt Martz

unread,
Jan 19, 2016, 8:54:31 AM1/19/16
to ansible...@googlegroups.com
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.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/803d8a4c-96b7-4911-9687-59069d4818ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
@sivel
sivel.net

Petri Lehtinen

unread,
Jan 21, 2016, 3:45:15 AM1/21/16
to Ansible Project
Ah, setting roles_path = roles in the correct section did the trick. Thanks a lot!

Petri


On Tuesday, January 19, 2016 at 3:54:31 PM UTC+2, Matt Martz wrote:
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.

On Tuesday, January 19, 2016, Petri Lehtinen <pe...@digip.org> wrote:
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

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages