molecule
molecule copied to clipboard
Molecule is ignoring meta/main.yaml instead of meta/main.yml
Issue Type
- Bug report
Molecule and Ansible details
$ molecule --version
molecule 4.0.4 using python 3.9
ansible:2.14.1
delegated:4.0.4 from molecule
docker:2.1.0 from molecule_docker requiring collections: community.docker>=3.0.2 ansible.posix>=1.4.0
Molecule installation method (one of):
- pip
Ansible installation method (one of):
- pip
Detail any linters or test runners used:
- not relevant
Desired Behavior
Either inform the user about the missing meta/main.yml or check for meta/main.yaml too and when it's not there report that, when necessary. But ansible-lint is absolutly fine with *.yaml files, so it should be accepted by molecule too.
Actual Behaviour
Whyever I did, but some time ago, I'm renamed a meta/main.yml to meta/main.yaml. Today I wanted to add molecule tests to my roles and it always ended with:
INFO default scenario test matrix: dependency, lint, cleanup, destroy, syntax, create, prepare, converge, idempotence, side_effect, verify, cleanup, destroy
INFO Performing prerun with role_name_check=0...
INFO Set ANSIBLE_LIBRARY=/...
INFO Set ANSIBLE_COLLECTIONS_PATH=/...
INFO Set ANSIBLE_ROLES_PATH=/...
INFO Running default > dependency
Starting galaxy role install process
- changing role acoby.common from main to main
- extracting acoby.common to /Users/trw/.cache/molecule/ansible-fail2ban/default/roles/acoby.common
- acoby.common (main) was installed successfully
INFO Dependency completed successfully.
WARNING Skipping, missing the requirements file.
INFO Running default > lint
INFO Lint is disabled.
INFO Running default > cleanup
WARNING Skipping, cleanup playbook not configured.
INFO Running default > destroy
INFO Sanity checks: 'docker'
....
ERROR! the role 'acoby.fail2ban' was not found in /github/workspace/molecule/default/roles:/github/home/.cache/ansible-compat/21a323/roles:/github/home/.cache/molecule/workspace/default/roles:/github:/github/home/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/github/workspace/molecule/default
The error appears to be in '/github/workspace/molecule/default/converge.yml': line 7, column 15, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
ansible.builtin.include_role:
name: "acoby.fail2ban"
^ here
The reason was - molecule did not know the name of the role inside the repo, because it looks silently for meta/main.yml and ignores the missing file or does not provide any feetback that it could not find a meta/main-file.
When I rename meta/main.yaml to ...yml, its working
Too bad I did not check the issue tracker carefully. Would have easily saved me two to three hours 🤦 Had to figure it out for myself.
Also it is not just meta/main.yaml. Molecule in general seems to only consider the .yml file extension.
Yes, that is inconsistent with the rest of ansible.
This issue is addressed in Support meta main yaml extension
Do .yaml work for anyone here already?
Both meta/main.yaml and meta/main.yml seem to work for me.
Though I suspect that my earlier comment was more about not supporting the .yaml extension in molecule specific files like molecule/default/molecule.yaml, which still doesn't work.