Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Molecule is ignoring meta/main.yaml instead of meta/main.yml #3849

Open
trickert76 opened this issue Mar 16, 2023 · 5 comments
Open

Molecule is ignoring meta/main.yaml instead of meta/main.yml #3849

trickert76 opened this issue Mar 16, 2023 · 5 comments
Labels

Comments

@trickert76
Copy link

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

@trickert76 trickert76 added the bug label Mar 16, 2023
@trallnag
Copy link

trallnag commented May 1, 2023

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.

@StarlessNights
Copy link

Yes, that is inconsistent with the rest of ansible.

@zhan9san
Copy link
Contributor

This issue is addressed in Support meta main yaml extension

@trallnag
Copy link

Do .yaml work for anyone here already?

@StarlessNights
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

4 participants