When going through the getting started guide test sequence the playbook fails with the following error:
$ python3.7 -m molecule create
--> Validating schema /Users/xxx/yyyy/ansible-molecule/test-role/molecule/default/molecule.yml.
Validation completed successfully.
--> Test matrix
└── default
├── create
└── prepare
--> Scenario: 'default'
--> Action: 'create'
[WARNING]: Skipping plugin
(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/molecule/provisioner/ansible/plugins/filters/molecule_core.py) as it
seems to be invalid: No module named 'molecule'
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:
ansible 2.7.6
config file = None
configured module search path = ['/Users/stephen/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible
executable location = /Library/Frameworks/Python.framework/Versions/3.6/bin/ansible
python version = 3.6.6 (v3.6.6:4cf1f54eb7, Jun 26 2018, 19:50:54) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
molecule, version 2.20.0.0a2
Molecule installation method (one of):
Ansible installation method (one of):
molecule should be available
It fails
Whoops, my mistake. I used a virtualenv to ensure molecule was installed correctly and it was.
Hi @surfer190, if you think we can improve the documentation, please send us a PR!
Happy hacking :rocket:
Hi; I ran into this problem as well while going through the test sequence, but found the answer (different from above):
# Fresh install on MacOS:
brew install ansible molecule
molecule init role my-new-role
cd my-new-role
docker run hello-world # Make sure "Docker desktop" is installed and running
molecule create # Error!
sudo pip3 install molecule-containers
sudo pip3 install docker-py
molecule create # Success!
molecule test # Success!
Most helpful comment
Hi; I ran into this problem as well while going through the test sequence, but found the answer (different from above):