Role imported from galaxy exists also as inner role

Hi

When execute the following command

ansible-galaxy install -r requirements.yml

using this requirements.yml file

The trick would be the repository owner not including that directory
in the repository

What is the trick to fix that ?

The role's directory must be the repo's top level. It's not here
https://github.com/ch007m/galaxy-role/tree/main/role-1

See structure of the directories "Roles"
https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html

and how to properly import a role

Many thanks. Can we import a git project containing several roles ?

Yes. Such a project is called a collection.
https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html#collection-structure
https://github.com/ansible-collections/

I did a test and the roles have been imported properly. Nevertheless I dont see how I would be able to consume them from tasks using “import_roles” as it will be needed that I hard code the full path …

ansible-galaxy install -r requirements-roles.yml
Starting galaxy collection install process
Process install dependency map
Starting collection install process

Installing ‘community.role-1:0.0.1’ to ‘/Users/cmoullia/.ansible/collections/ansible_collections/community/role-1’
Created collection for community.role-1 at /Users/cmoullia/.ansible/collections/ansible_collections/community/role-1
community.role-1 (0.0.1) was installed successfully

Installing ‘community.role-2:0.0.1’ to ‘/Users/cmoullia/.ansible/collections/ansible_collections/community/role-2’
Created collection for community.role-2 at /Users/cmoullia/.ansible/collections/ansible_collections/community/role-2
community.role-2 (0.0.1) was installed successfully