When creating an ansible role you can specify the dependencies in meta/main.yml as follows
dependencies:
- role: papanito.xxx
How I do this, if papanito.xxx was converted into a collection? Or let's phrase it otherwise: How to I tell my role, that it depends on a module/role from a collection?
If I run ansible-playbook which uses a role, that has a dependency to a role in a collection, get the following error:
ERROR! the role 'papanito.xxx' was not found in ansible.legacy:
/home/papanito/Workspaces/devenv/roles:
/home/papanito/.ansible/roles:
/usr/share/ansible/roles:
/etc/ansible/roles:
/home/papanito/Workspaces/devenv/roles:
/home/papanito/Workspaces/devenv
As I can see ansible checks these paths for roles, however, collections are stored under /home/papanito/.ansible/collections/ansible_collections/.
I suspect this has to do with the mention of ansible.legacy, however I did not configure anything like that - intentionally at least.
Using role: the_namespace.the_collection.the_role does not solve the problem, but I still get the same error.
Further the documentation says
Within a role, you can control which
collectionsAnsible searches for the tasks inside the role using the collections keyword in the role’smeta/main.yml
So I updated meta/main.yml to
collections:
- papanito.xxx
dependencies:
- role: papanito.xxx.xxx
Which still results in the exact same error as above when I run the playbook.