I have the following directory structure in my playbook:
deploy-thing
├── README.md
├── files
│ ├── thing.service
│ └── ld.local.conf
├── main.yml
├── roles
│ ├── ansible-role-add-swap
│ │ ├── README.md
│ │ ├── defaults
│ │ │ └── main.yml
│ │ └── tasks
│ │ └── main.yml
│ ├── ansible-role-build-pkgs
│ │ └── tasks
│ │ └── main.yml
│ ├── ansible-role-deploy-other-thing
│ │ ├── README.md
│ │ ├── main.yml
│ │ ├── roles
│ │ │ ├── ansible-role-build-pkgs
│ │ │ │ └── tasks
│ │ │ │ └── main.yml
│ │ │ └── ansible-role-build-redis
│ │ │ ├── README.md
│ │ │ └── tasks
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
└── vars.yml
Within main.yml, the following is called:
roles:
- {role: ./roles/ansible-role-deploy-other-thing}
Within roles/ansible-role-deploy-other-thing/tasks/main.yml, the following is called:
- include_role:
name: ansible-role-build-redis
When run, this include_role
causes the following error:
ERROR! the role 'ansible-role-build-redis' was not found in /Users/myuser/playbooks/deploy-thing/roles:/Users/myuser/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/Users/myuser/playbooks/deploy-thing
It appears that the parent is only searching its own roles path when running, not the role path of the role we're using (ansible-role-deploy-other-thing). How can I cause it to search its own roles path, allowing me to deploy roles within roles?