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 seems to fail when Ansible is installed from rpm #2173
Comments
Have you tried using code from master branch? If you cannot replicate it with master we can close it. |
Good catch. With master works. Thanks! |
I replicated it using the latest version. My bad, I thought it was fixed but I didn't try exactly the same thing. So:
$ molecule init role -r test-molecule
--> Initializing new role test-molecule...
Initialized role in /tmp/test-molecule successfully.
$ cd test-molecule/
$ cat molecule/default/molecule.yml
---
dependency:
name: galaxy
driver:
name: podman
lint:
name: yamllint
platforms:
- name: instance
image: centos:7
provisioner:
name: ansible
lint:
name: ansible-lint
verifier:
name: testinfra
lint:
name: flake8
$ molecule test
$ molecule test
--> Validating schema /tmp/test-molecule/molecule/default/molecule.yml.
Validation completed successfully.
--> Test matrix
└── default
├── lint
├── dependency
├── cleanup
├── destroy
├── syntax
├── create
├── prepare
├── converge
├── idempotence
├── side_effect
├── verify
├── cleanup
└── destroy
--> Scenario: 'default'
--> Action: 'lint'
--> Executing Yamllint on files found in /tmp/test-molecule/...
Lint completed successfully.
--> Executing Flake8 on files found in /tmp/test-molecule/molecule/default/tests/...
Lint completed successfully.
--> Executing Ansible Lint on /tmp/test-molecule/molecule/default/playbook.yml...
[701] Role info should contain platforms
/tmp/test-molecule/meta/main.yml:2
{'meta/main.yml': {'galaxy_info': {'author': 'your name', 'description': 'your description', 'company': 'your company (optional)', 'license': 'license (GPLv2, CC-BY, etc)', 'min_ansible_version': 1.2, 'gala$y_tags': [], '__line__': 3, '__file__': '/tmp/test-molecule/meta/main.yml'}, 'dependencies': [], '__line__': 2, '__file__': '/tmp/test-molecule/meta/main.yml'}}
[703] Should change default metadata: author
/tmp/test-molecule/meta/main.yml:2
{'meta/main.yml': {'galaxy_info': {'author': 'your name', 'description': 'your description', 'company': 'your company (optional)', 'license': 'license (GPLv2, CC-BY, etc)', 'min_ansible_version': 1.2, 'gala$y_tags': [], '__line__': 3, '__file__': '/tmp/test-molecule/meta/main.yml'}, 'dependencies': [], '__line__': 2, '__file__': '/tmp/test-molecule/meta/main.yml'}}
[703] Should change default metadata: description
/tmp/test-molecule/meta/main.yml:2
{'meta/main.yml': {'galaxy_info': {'author': 'your name', 'description': 'your description', 'company': 'your company (optional)', 'license': 'license (GPLv2, CC-BY, etc)', 'min_ansible_version': 1.2, 'gala$y_tags': [], '__line__': 3, '__file__': '/tmp/test-molecule/meta/main.yml'}, 'dependencies': [], '__line__': 2, '__file__': '/tmp/test-molecule/meta/main.yml'}}
[703] Should change default metadata: company
/tmp/test-molecule/meta/main.yml:2
{'meta/main.yml': {'galaxy_info': {'author': 'your name', 'description': 'your description', 'company': 'your company (optional)', 'license': 'license (GPLv2, CC-BY, etc)', 'min_ansible_version': 1.2, 'galax
y_tags': [], '__line__': 3, '__file__': '/tmp/test-molecule/meta/main.yml'}, 'dependencies': [], '__line__': 2, '__file__': '/tmp/test-molecule/meta/main.yml'}}
[703] Should change default metadata: license
/tmp/test-molecule/meta/main.yml:2
{'meta/main.yml': {'galaxy_info': {'author': 'your name', 'description': 'your description', 'company': 'your company (optional)', 'license': 'license (GPLv2, CC-BY, etc)', 'min_ansible_version': 1.2, 'galax
y_tags': [], '__line__': 3, '__file__': '/tmp/test-molecule/meta/main.yml'}, 'dependencies': [], '__line__': 2, '__file__': '/tmp/test-molecule/meta/main.yml'}}
An error occurred during the test sequence action: 'lint'. Cleaning up.
--> Scenario: 'default'
--> Action: 'cleanup'
Skipping, cleanup playbook not configured.
--> Scenario: 'default'
--> Action: 'destroy'
[WARNING]: Skipping plugin (/home/asaezmor/Developer/src/github.com/ansible/mo
lecule-2.22rc3/molecule/provisioner/ansible/plugins/filters/molecule_core.py)
as it seems to be invalid: No module named 'molecule'
PLAY [Destroy] *****************************************************************
TASK [Destroy molecule instance(s)] ********************************************
fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred while templating '{{ lookup('file', molecule_file) | molecule_from_yaml }}'. Error was a <class 'ansible.errors.AnsibleError'>, origina
l message: template error while templating string: no filter named 'molecule_from_yaml'. String: {{ lookup('file', molecule_file) | molecule_from_yaml }}"}
PLAY RECAP *********************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
ERROR:
$ molecule test
--> Validating schema /tmp/test-molecule/molecule/default/molecule.yml.
Validation completed successfully.
--> Test matrix
└── default
├── lint
├── dependency
├── cleanup
├── destroy
├── syntax
├── create
├── prepare
├── converge
├── idempotence
├── side_effect
├── verify
├── cleanup
└── destroy
--> Scenario: 'default'
--> Action: 'lint'
--> Executing Yamllint on files found in /tmp/test-molecule/...
Lint completed successfully.
--> Executing Flake8 on files found in /tmp/test-molecule/molecule/default/tests/...
Lint completed successfully.
--> Executing Ansible Lint on /tmp/test-molecule/molecule/default/playbook.yml...
[701] Role info should contain platforms
/tmp/test-molecule/meta/main.yml:2
{'meta/main.yml': {'galaxy_info': {'author': 'your name', 'description': 'your description', 'company': 'your company (optional)', 'license': 'license (GPLv2, CC-BY, etc)', 'min_ansible_version': 1.2, 'galaxy_tags': [], '__line__': 3, '__file__': '/tmp/test-molecule/meta/main.yml'}, 'dependencies': [], '__line__': 2, '__file__': '/tmp/test-molecule/meta/main.yml'}}
[703] Should change default metadata: author
/tmp/test-molecule/meta/main.yml:2
{'meta/main.yml': {'galaxy_info': {'author': 'your name', 'description': 'your description', 'company': 'your company (optional)', 'license': 'license (GPLv2, CC-BY, etc)', 'min_ansible_version': 1.2, 'galaxy_tags': [], '__line__': 3, '__file__': '/tmp/test-molecule/meta/main.yml'}, 'dependencies': [], '__line__': 2, '__file__': '/tmp/test-molecule/meta/main.yml'}}
[703] Should change default metadata: description
/tmp/test-molecule/meta/main.yml:2
{'meta/main.yml': {'galaxy_info': {'author': 'your name', 'description': 'your description', 'company': 'your company (optional)', 'license': 'license (GPLv2, CC-BY, etc)', 'min_ansible_version': 1.2, 'galaxy_tags': [], '__line__': 3, '__file__': '/tmp/test-molecule/meta/main.yml'}, 'dependencies': [], '__line__': 2, '__file__': '/tmp/test-molecule/meta/main.yml'}}
[703] Should change default metadata: company
/tmp/test-molecule/meta/main.yml:2
{'meta/main.yml': {'galaxy_info': {'author': 'your name', 'description': 'your description', 'company': 'your company (optional)', 'license': 'license (GPLv2, CC-BY, etc)', 'min_ansible_version': 1.2, 'galaxy_tags': [], '__line__': 3, '__file__': '/tmp/test-molecule/meta/main.yml'}, 'dependencies': [], '__line__': 2, '__file__': '/tmp/test-molecule/meta/main.yml'}}
[703] Should change default metadata: license
/tmp/test-molecule/meta/main.yml:2
{'meta/main.yml': {'galaxy_info': {'author': 'your name', 'description': 'your description', 'company': 'your company (optional)', 'license': 'license (GPLv2, CC-BY, etc)', 'min_ansible_version': 1.2, 'galaxy_tags': [], '__line__': 3, '__file__': '/tmp/test-molecule/meta/main.yml'}, 'dependencies': [], '__line__': 2, '__file__': '/tmp/test-molecule/meta/main.yml'}}
An error occurred during the test sequence action: 'lint'. Cleaning up.
--> Scenario: 'default'
--> Action: 'cleanup'
Skipping, cleanup playbook not configured.
--> Scenario: 'default'
--> Action: 'destroy'
PLAY [Destroy] *****************************************************************
TASK [Destroy molecule instance(s)] ********************************************
changed: [localhost] => (item=None)
changed: [localhost]
TASK [Wait for instance(s) deletion to complete] *******************************
changed: [localhost] => (item=None)
changed: [localhost]
PLAY RECAP *********************************************************************
localhost : ok=2 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
--> Pruning extra files from scenario ephemeral directory So I think something is different between the rpm and the pip installations. |
Wait but now it is just failing with linting errors? |
(Excuse me from the side.) I think that the RPM does not work because all of filters and plugins (.py files) under molecule/provisioner/ansible/ are missing (and might not be installed) from it.
|
We faced the same issue yesterday at https://bugs.launchpad.net/tripleo/+bug/1837143 and apparently this is caused by the decision of making the scripts installed use |
One thing is clear: this is not a molecule bug and is likely what I would call a packaging bug (hopefully not an intended feature). I would usually try to raise it as an Ansible bug but if you look at https://releases.ansible.com/ansible/rpm/release/ you will not find an ansible 2.8 based on python3.6 so.... you mainly used a non-official ansible distribution. Time to file it un bugzilla against RHEL. |
@decentral1se no, sorry, was another test in a new role. |
I have the same problem on fedora 30 with ansible 2.8.2 installed from the official repository. |
@alexsaezm do you use Fedora? |
I've removed molecule from pip3 and pip2, remove ansible by dnf and then install ansible and molecule from pip3 and it's working fine for me now. |
Should we close this or? |
Can it be reopened until the issue is fixed on Ansible rpm packaging side? @tutunak your workaround works for me thanks! sudo yum -y remove ansible
pip3 install ansible --user
pip3 install "molecule[lint]" --user
pip3 install "molecule[docker]" --user |
Issue Type
Molecule and Ansible details
Molecule installation method (one of):
Ansible installation method (one of):
Desired Behavior
The execution should work no matter how Ansible was installed.
Actual Behaviour
When installed from a rpm file (
ansible-2.8.2-1.el8ae.noarch.rpm
) the execution failed.Using pip, everything works.
The text was updated successfully, but these errors were encountered: