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.

No filter named 'molecule_from_yaml' on fresh Molecule

See original GitHub issue

Issue Type

  • Bug report

Molecule and Ansible details

ansible 2.7.9
  config file = /Users/a0s/.ansible.cfg
  configured module search path = [u'/Users/a0s/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.15 (default, Jan 12 2019, 21:43:48) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)]
molecule, version 2.19.0

Molecule installation method (one of):

  • pip

Ansible installation method (one of):

  • brew

Detail any linters or test runners used:

Desired Behavior

Idempotence completed successfully. message

Actual Behaviour

a0s@cto:~ [2.4.5 ] $ molecule init role --role-name my-role
--> Initializing new role my-role...
Initialized role in /Users/a0s/my-role successfully.

a0s@cto:~ [2.4.5 ] $ cd my-role/

a0s@cto:~/my-role [2.4.5 ] $ molecule test
--> Validating schema /Users/a0s/my-role/molecule/default/molecule.yml.
Validation completed successfully.
--> Test matrix

└── default
    ├── lint
    ├── destroy
    ├── dependency
    ├── syntax
    ├── create
    ├── prepare
    ├── converge
    ├── idempotence
    ├── side_effect
    ├── verify
    └── destroy

--> Scenario: 'default'
--> Action: 'lint'
--> Executing Yamllint on files found in /Users/a0s/my-role/...
Lint completed successfully.
--> Executing Flake8 on files found in /Users/a0s/my-role/molecule/default/tests/...
Lint completed successfully.
--> Executing Ansible Lint on /Users/a0s/my-role/molecule/default/playbook.yml...
Lint completed successfully.
--> Scenario: 'default'
--> Action: 'destroy'
 [WARNING]: Skipping plugin (/usr/local/lib/python2.7/site-
packages/molecule/provisioner/ansible/plugins/filters/molecule_core.py) as it
seems to be invalid: cannot import name py31compat


    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'>, 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

ERROR:
An error occurred during the test sequence action: 'destroy'. Cleaning up.
--> Scenario: 'default'
--> Action: 'destroy'
 [WARNING]: Skipping plugin (/usr/local/lib/python2.7/site-
packages/molecule/provisioner/ansible/plugins/filters/molecule_core.py) as it
seems to be invalid: cannot import name py31compat


    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'>, 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

ERROR:

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
apatardcommented, Jan 20, 2021

I’m not sure if I’m understanding this. If the work around is to install and run as root then this issue isn’t fixed. If that’s the case why is this closed?

@kuwv this bug is about molecule 2.X. In molecule 3.X, the filter is not provided with molecule since 3.1.1 (https://github.com/ansible-community/molecule/pull/2869/)

1reaction
caleb15commented, Sep 3, 2019

I got the same error, I was able to fix it by making sure molecule and ansible were both installed not with the --user option.

Read more comments on GitHub >

github_iconTop Results From Across the Web

no filter named 'molecule_from_yaml' with molecule ec2 driver ...
I am running a Molecule v2.22 and I am want to spin up an ec2 ... error while templating string: no filter named...
Read more >
no filter named 'molecule_from_yaml' (#25) · Issues
When running ansible-playbook --private-key id_rsa --user debian -i /tmp/molecule/infrastructure/enough/ansible_inventory.yml ...
Read more >
template error while templating string: no filter named 'failed'
I see the filter "failed" documented in Jinja2 here. Why is it not working? MY ENV: ansible --version ansible 2.10.7 config file =...
Read more >
Single molecule FRET analysis — sdt-python 17.3 ...
The sdt.fret module provides functionality to analyze single molecule FRET data. ... keep (Union[str, Iterable[str]]) – Filter column name(s) to keep.
Read more >
ansible/ansible - Gitter
frague59 I've a list of dicts named directories set in project vars - I'ld like to ... so i used molecule to test...
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