Collection testing with molecule, roles are not reconized

Hi guys,

We are currently creating our own collections which we will provide internally via the private hub functionality of the AAP.

For this I created a template for the collections. Main use case is to provide roles for our automation.
In the CI/CD pipline we use ansible-test for the collection itself and additionally we want to use molecule to test the single roles.

The git repo of a collection looks like this:

general
├── ansible.cfg
├── ansible_collections
│   └── <namespace>
│       └── general
│           ├── docs
│           ├── galaxy.yml
│           ├── meta
│           │   └── runtime.yml
│           ├── plugins
│           │   └── README.md
│           ├── README.md
│           ├── requirements.txt
│           └── roles
│               └── create_ci
│                   ├── defaults
│                   │   └── main.yml
│                   ├── handlers
│                   │   └── main.yml
│                   ├── meta
│                   │   └── main.yml
│                   ├── README.md
│                   ├── requirements.yml
│                   ├── tasks
│                   │   └── main.yml
│                   ├── tests
│                   │   ├── inventory
│                   │   └── test.yml
│                   └── vars
│                       └── main.yml
├── molecule
│   └── default
│       ├── converge.yml
│       ├── create.yml
│       ├── destroy.yml
│       └── molecule.yml
└── README.md

The folder structure under ansible_collection / namespace / collection is used to create a clean collection with ansible-galaxy collection build in the release pipline and upload it to the hub

If I create the collection, upload it to the hub and install it to a system I can use the role without any issues. In the molecule output I can see the path, which is set in the molecule.yml below

If I try to test the role with molecule I get always the error, the role is not found.

provisioner:
  name: ansible
  env:
    ANSIBLE_ROLES_PATH: "../../ansible_collections/<namespace>/general/roles"

Any ideas where the issue can be located?
molecule 6.0.2 using python 3.9
ansible:2.15.5
default:6.0.2 from molecule

Hi,

Have a look here: Sharing - Ansible Molecule :slight_smile:

Hi Pierre,
Unfortunately, this didn’t help. Molecule lists the path to the roles folder, but does not recognize the roles

Did you ever get this figured out? I may be able to help. You may need to use fqcn on your converge.yml