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):
Ansible installation method (one of):
Detail any linters or test runners used:
Idempotence completed successfully. message
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:
[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
molecule_core.py provides the molecule_from_yaml filter. I'm guessing that the setuptools package is either outdated or not installed.
@seandst You're right! It works with fresh pyenv-virtualenv's environment. Also, i used python-3.7.2 and docker (not docker-py)
That's great news, since that was my only guess. :D
I'm glad it's working for you now.
I get the same error about missing filther even when I do have recent setuptools but what makes it unique is that i always happens only when inside a virtualenv that is using site-packages. Seems very similar to https://github.com/ansible/molecule/issues/1888
FTR I'm hitting the same error with filter not found now.
Alright... It seems to be related to https://github.com/ansible/molecule/issues/2012.
This hints us that failure to import anyconfig prevents molecule_core.py filters from being loaded.
[WARNING]: Skipping plugin (/tmp/mol-test/mol_venv/lib/python3.7/site-packages/molecule/provisioner/ansible/plugins/filters/molecule_core.py) as it seems to be invalid: No module named 'anyconfig'
The interesting part is that anyconfig is installed in the same virtualenv as molecule itself.
im hitting the same error.... no warning for me... it just tells me
molecule converge 37.3s ๎ณ Mo 06 Mai 2019 08:43:31 CEST
--> Validating schema /home/preuss/src/server_provisioning/roles/testrolle/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'
PLAY [Create] ******************************************************************
TASK [Log into a Docker registry] **********************************************
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:
did nothing fancy... just install molecule in a own venv, created a fresh role... and started to run it.
@xsteadfastx it would be very useful if you could record that with asciinema starting with molecule install and role generation...
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.
Thanks for the hintm @caleb15 - that actually helped on macOS 10.15.
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?
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/)
@apatard Well, guess that means there's a bug in molecule-ec2:
fatal: [localhost]: FAILED! => {"msg": "template error while templating string: no filter named 'molecule_from_yaml'. String: {{ lookup('file', molecule_instance_config) | molecule_from_yaml }}"}
Edit:
https://github.com/ansible-community/molecule-ec2/issues/33
Someone needs to help with ec2 module maintenance, I added comment on https://github.com/ansible-community/molecule-ec2/pull/34#pullrequestreview-572472108 but I am unable to do it myself.
I can only help with reviews and releases, already overloaded.