question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Molecule seems to fail when Ansible is installed from rpm

See original GitHub issue

Issue Type

  • Bug report

Molecule and Ansible details

ansible 2.8.2
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/asaezmor/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Apr  3 2019, 17:26:03) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)]
molecule, version 2.20.1

Molecule installation method (one of):

  • pip

Ansible installation method (one of):

  • pip
  • rpm

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.

$ molecule --debug converge
--> Validating schema /home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab/molecule/default/molecule.yml.
Validation completed successfully.
--> Test matrix
    
└── default
    ├── dependency
    ├── create
    ├── prepare
    └── converge
    
--> Scenario: 'default'
--> Action: 'dependency'
Skipping, missing the requirements file.
--> Scenario: 'default'
--> Action: 'create'
DEBUG: ANSIBLE ENVIRONMENT
---
ANSIBLE_CONFIG: /tmp/molecule/fedora-lab/default/ansible.cfg
ANSIBLE_FILTER_PLUGINS: /home/asaezmor/.local/lib/python3.6/site-packages/molecule/provisioner/ansible/plugins/filters:/tmp/molecule/fedora-lab/default/plugins/filters:/home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab/plugins/filters
ANSIBLE_LIBRARY: /home/asaezmor/.local/lib/python3.6/site-packages/molecule/provisioner/ansible/plugins/libraries:/tmp/molecule/fedora-lab/default/library:/home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab/library
ANSIBLE_ROLES_PATH: /tmp/molecule/fedora-lab/default/roles:/home/asaezmor/Developer/src/github.com/alexsaezm

DEBUG: MOLECULE ENVIRONMENT
---
MOLECULE_DEBUG: 'True'
MOLECULE_DEPENDENCY_NAME: galaxy
MOLECULE_DRIVER_NAME: docker
MOLECULE_ENV_FILE: /home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab/.env.yml
MOLECULE_EPHEMERAL_DIRECTORY: /tmp/molecule/fedora-lab/default
MOLECULE_FILE: /home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab/molecule/default/molecule.yml
MOLECULE_INSTANCE_CONFIG: /tmp/molecule/fedora-lab/default/instance_config.yml
MOLECULE_INVENTORY_FILE: /tmp/molecule/fedora-lab/default/inventory/ansible_inventory.yml
MOLECULE_LINT_NAME: yamllint
MOLECULE_PROJECT_DIRECTORY: /home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab
MOLECULE_PROVISIONER_LINT_NAME: ansible-lint
MOLECULE_PROVISIONER_NAME: ansible
MOLECULE_SCENARIO_DIRECTORY: /home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab/molecule/default
MOLECULE_SCENARIO_NAME: default
MOLECULE_VERIFIER_LINT_NAME: flake8
MOLECULE_VERIFIER_NAME: testinfra
MOLECULE_VERIFIER_TEST_DIRECTORY: /home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab/molecule/default/tests

DEBUG: SHELL REPLAY
ANSIBLE_CONFIG=/tmp/molecule/fedora-lab/default/ansible.cfg ANSIBLE_FILTER_PLUGINS=/home/asaezmor/.local/lib/python3.6/site-packages/molecule/provisioner/ansible/plugins/filters:/tmp/molecule/fedora-lab/default/plugins/filters:/home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab/plugins/filters ANSIBLE_LIBRARY=/home/asaezmor/.local/lib/python3.6/site-packages/molecule/provisioner/ansible/plugins/libraries:/tmp/molecule/fedora-lab/default/library:/home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab/library ANSIBLE_ROLES_PATH=/tmp/molecule/fedora-lab/default/roles:/home/asaezmor/Developer/src/github.com/alexsaezm MOLECULE_DEBUG=True MOLECULE_DEPENDENCY_NAME=galaxy MOLECULE_DRIVER_NAME=docker MOLECULE_ENV_FILE=/home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab/.env.yml MOLECULE_EPHEMERAL_DIRECTORY=/tmp/molecule/fedora-lab/default MOLECULE_FILE=/home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab/molecule/default/molecule.yml MOLECULE_INSTANCE_CONFIG=/tmp/molecule/fedora-lab/default/instance_config.yml MOLECULE_INVENTORY_FILE=/tmp/molecule/fedora-lab/default/inventory/ansible_inventory.yml MOLECULE_LINT_NAME=yamllint MOLECULE_PROJECT_DIRECTORY=/home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab MOLECULE_PROVISIONER_LINT_NAME=ansible-lint MOLECULE_PROVISIONER_NAME=ansible MOLECULE_SCENARIO_DIRECTORY=/home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab/molecule/default MOLECULE_SCENARIO_NAME=default MOLECULE_VERIFIER_LINT_NAME=flake8 MOLECULE_VERIFIER_NAME=testinfra MOLECULE_VERIFIER_TEST_DIRECTORY=/home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab/molecule/default/tests

DEBUG: COMMAND
/usr/bin/ansible-playbook --skip-tags=molecule-notest,notest --diff --inventory=/tmp/molecule/fedora-lab/default/inventory /home/asaezmor/.local/lib/python3.6/site-packages/molecule/provisioner/ansible/playbooks/docker/create.yml -vvv

    ansible-playbook 2.8.2
      config file = /tmp/molecule/fedora-lab/default/ansible.cfg
      configured module search path = ['/home/asaezmor/.local/lib/python3.6/site-packages/molecule/provisioner/ansible/plugins/libraries', '/tmp/molecule/fedora-lab/default/library', '/home/asaezmor/Developer/src/github.com/alexsaezm/fedora-lab/library']
      ansible python module location = /usr/lib/python3.6/site-packages/ansible
      executable location = /usr/bin/ansible-playbook
      python version = 3.6.8 (default, Apr  3 2019, 17:26:03) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)]
    Using /tmp/molecule/fedora-lab/default/ansible.cfg as config file
    host_list declined parsing /tmp/molecule/fedora-lab/default/inventory/ansible_inventory.yml as it did not pass it's verify_file() method
    script declined parsing /tmp/molecule/fedora-lab/default/inventory/ansible_inventory.yml as it did not pass it's verify_file() method
    Parsed /tmp/molecule/fedora-lab/default/inventory/ansible_inventory.yml inventory source with yaml plugin
    
    PLAYBOOK: create.yml ***********************************************************
    1 plays in /home/asaezmor/.local/lib/python3.6/site-packages/molecule/provisioner/ansible/playbooks/docker/create.yml
 [WARNING]: Skipping plugin (/home/asaezmor/.local/lib/python3.6/site-
packages/molecule/provisioner/ansible/plugins/filters/molecule_core.py) as it
seems to be invalid: No module named 'molecule'

    
    PLAY [Create] ******************************************************************
    META: ran handlers
    
    TASK [Log into a Docker registry] **********************************************
    task path: /home/asaezmor/.local/lib/python3.6/site-packages/molecule/provisioner/ansible/playbooks/docker/create.yml:8
    fatal: [localhost]: FAILED! => {
        "msg": "An unhandled exception occurred while templating '{{ lookup('file', molecule_file) | molecule_from_yaml }}'. Error was a <class 'ansible.errors.AnsibleError'>, original 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: 

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
matihostcommented, Feb 21, 2020

Can it be reopened until the issue is fixed on Ansible rpm packaging side? It is there RH Bugzilla or issue already posted anywhere?

@tutunak your workaround works for me thanks! Snippet for anybody else:

sudo yum -y remove ansible
pip3 install ansible --user
pip3 install "molecule[lint]" --user
pip3 install "molecule[docker]" --user
2reactions
tutunakcommented, Sep 2, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Molecule seems to fail when Ansible is installed from rpm #2173
Issue Type Bug report Molecule and Ansible details ansible 2.8.2 config ... Molecule seems to fail when Ansible is installed from rpm #2173....
Read more >
Ansible install yum repo from rpm package [closed]
I'd modify your 3rd attempt to use the yum module to install the Percona rpm which sets up the repository and installs the...
Read more >
Continuous integration — Molecule Documentation
Continuous integration . Molecule output will use ANSI colors if stdout is an interactive TTY and TERM value seems to support it....
Read more >
Fix lint and molecule jobs after release of cryptography3.4
Molecule job fails with: ModuleNotFoundError: No module named 'setuptools_rust' This error appeared following the release of cryptography 3.4, ...
Read more >
Playbook fails on check but runs fine otherwise - Google Groups
to Ansible Project. Hi all,. I have a playbook which installs an rpm. The rpm requires input (yikes), so I have written an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found