Role dependency and search path

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_commonor/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?

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