# Ansible 2 upgrade broke roles directory lookup

**URL:** <https://forum.ansible.com/t/ansible-2-upgrade-broke-roles-directory-lookup/20997>\
**Category:** Ansible Project\
**Created:** [March 28, 2016, 3:24pm UTC](https://forum.ansible.com/t/ansible-2-upgrade-broke-roles-directory-lookup/20997 "2016-03-28T15:24:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alastair\_Brayne1](https://avatars.discourse-cdn.com/v4/letter/a/df788c/32.png) [@Alastair\_Brayne1](https://forum.ansible.com/u/Alastair_Brayne1)\
**Post date:** [March 28, 2016, 3:24pm UTC](https://forum.ansible.com/t/ansible-2-upgrade-broke-roles-directory-lookup/20997/1 "2016-03-28T15:24:50Z")

</div>

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](mailto:al@perchten.co.uk)**  
t: **07779266625**  
w: **[http://perchten.co.uk](http://perchten.co.uk/)**

![](http://perchten.co.uk/email_signature.png)

---

<div class="post-metadata">

**Author:** ![Uditha\_Desilva](https://avatars.discourse-cdn.com/v4/letter/u/f475e1/32.png) [@Uditha\_Desilva](https://forum.ansible.com/u/Uditha_Desilva)\
**Post date:** [March 28, 2016, 6:20pm UTC](https://forum.ansible.com/t/ansible-2-upgrade-broke-roles-directory-lookup/20997/2 "2016-03-28T18:20:42Z")

</div>

It looks like you’re implicitly that “included” playbook as your first task, and thus you’re mixing up the use of role and include in a rather odd way. Is there any reason why you’re invoking it directly?

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [March 30, 2016, 12:42pm UTC](https://forum.ansible.com/t/ansible-2-upgrade-broke-roles-directory-lookup/20997/3 "2016-03-30T12:42:40Z")

</div>

Any reason why you are not using that like your other roles?

- hosts: foo  
&nbsp;&nbsp;roles:  
&nbsp;&nbsp;&nbsp;&nbsp;- common  
&nbsp;&nbsp;&nbsp;&nbsp;- java  
&nbsp;&nbsp;&nbsp;&nbsp;- ec2

Regards,  
Johannes
