# Role dependency and search path

**URL:** <https://forum.ansible.com/t/role-dependency-and-search-path/18516>\
**Category:** Ansible Developer\
**Created:** [June 16, 2015, 12:57pm UTC](https://forum.ansible.com/t/role-dependency-and-search-path/18516 "2015-06-16T12:57:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Strahinja\_Kustudic2](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Strahinja\_Kustudic2](https://forum.ansible.com/u/Strahinja_Kustudic2)\
**Post date:** [June 16, 2015, 12:57pm UTC](https://forum.ansible.com/t/role-dependency-and-search-path/18516/1 "2015-06-16T12:57:07Z")

</div>

If I have a directory structure like this:

`  
├── app1\_playbooks  
│ └── deploy.yml  
├── hosts  
└── roles  
├── app1  
└── app\_common

`

**app1\_playbooks/deploy.yml** looks like this:

`

- hosts: all  
roles:
- { role: ‘…/roles/app1’, tags: ‘app1’ }  
`

and role **app1** depends on the role **app\_common**.

The problem here is that if you run:

`  
ansible-playbook -i hosts app1\_playbooks/deploy.yml

`

Ansible will throw an error:

` ERROR: cannot find role in /home/user/ansible_playbooks/`app1\_playbooks`/roles/`app\_common`or`/home/user/ansible\_playbooks/`app1_playbooks`/`app_common`` or /etc/ansible/roles `

Why doesn’t Ansible search for role dependencies in the directory of the current role, but only in the roles\_path (and a few predefined paths). My question is could we add that it also searches in the directory of the role which depends on other roles?

---

<div class="post-metadata">

**Author:** ![Strahinja\_Kustudic2](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Strahinja\_Kustudic2](https://forum.ansible.com/u/Strahinja_Kustudic2)\
**Post date:** [June 17, 2015, 8:58am UTC](https://forum.ansible.com/t/role-dependency-and-search-path/18516/2 "2015-06-17T08:58:59Z")

</div>

I was looking into how this could be implemented and I noticed that this is already implemented in 2.0, so kudos for that 🙂
