Hey,
I’ve just upgraded to Ansible 2 and my playbooks have stopped working. The specific error I get is:
`
ERROR! the role ‘common’ was not found in //roles/ec2/tasks/roles://roles/ec2/tasks:/etc/ansible/roles
The error appears to have been in ‘//site.yml’: line 5, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
roles:
- common
^ here
`
My sites.yml
looks like:
`
-
include: roles/ec2/tasks/load_ec2_group_foo.yml
-
hosts: foo
roles: -
common
-
java
`
My directory structure looks like this:
`
hosts
- app
- ec2.py
roles - common
- java
site.yml
`
No .ansible.cfg file.
Run command:
`
ansible-playbook -i hosts site.yml
`
It worked absolutely fine in 1.9. Just broke with the upgrade. I made no other changes.
What I notice and find interesting is that the search path for the roles uses /roles/ec2/tasks/roles, /roles/ec2/tasks, and /etc/ansible/roles. It looks almost like the include statement on line 1 in the site.yml file is setting this path lookup. What it is missing is of course an entry in this list for /roles.
Anyone got any idea why this might be? Does the include now do an internal cd or something and then leave itself in the wrong directory? No idea about the bowels of ansible, I’ve never dug into it.
Any help much appreciated
Thanks
Alastair
e: al@perchten.co.uk
t: 07779266625
w: http://perchten.co.uk