molecule: Can't run a basic test.

Issue Type

Bug report

Molecule and Ansible Details

(.venv) [root@molecule httpd]# ansible --version
ansible 2.5.0
  config file = None
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /root/.venv/lib/python2.7/site-packages/ansible
  executable location = /root/.venv/bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
(.venv) [root@molecule httpd]# molecule --version
molecule, version 2.11.0

Molecule installation method (one of): pip

Ansible installation method (one of): pip

Desired Behavior

I followed all the steps on the quick-start but it didn’t go as smoothly as it should’ve. (CentOS 7)

yum install -y epel-release
yum install -y python-pip gcc python-devel openssl-devel
pip install virtualenv
virtualenv --no-site-packages .venv
source .venv/bin/activate
pip install molecule ansible docker-py
molecule init role -r httpd -d docker
cd httpd
molecule test

Actual Behaviour (Bug report only)

(.venv) [root@molecule httpd]# molecule test
--> Validating schema /root/httpd/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 /root/httpd/...
Lint completed successfully.
--> Executing Flake8 on files found in /root/httpd/molecule/default/tests/...
Lint completed successfully.
--> Executing Ansible Lint on /root/httpd/molecule/default/playbook.yml...
Lint completed successfully.
--> Scenario: 'default'
--> Action: 'destroy'

    PLAY [Destroy] *****************************************************************

    TASK [Destroy molecule instance(s)] ********************************************
    changed: [localhost] => (item=None)

    TASK [Wait for instance(s) deletion to complete] *******************************
    failed: [localhost] (item=None) => {"attempts": 1, "censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}

    PLAY RECAP *********************************************************************
    localhost                  : ok=1    changed=1    unreachable=0    failed=1


ERROR:
An error occured during the test sequence.  Cleaning up.
--> Scenario: 'default'
--> Action: 'destroy'

    PLAY [Destroy] *****************************************************************

    TASK [Destroy molecule instance(s)] ********************************************
    changed: [localhost] => (item=None)

    TASK [Wait for instance(s) deletion to complete] *******************************
    failed: [localhost] (item=None) => {"attempts": 1, "censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}

    PLAY RECAP *********************************************************************
    localhost                  : ok=1    changed=1    unreachable=0    failed=1


ERROR:

Here’s the full output with --debug.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

Just been hitting the selinux issue whilst using Molecule on a Fedora 28 laptop.

SELinux is set to: Permissive and the python2-libselinux package is installed.

Managed to get this working by copying the directory over as mentioned above, however I also had to copy over the .so file too.

cp -r /usr/lib64/python2.7/site-packages/selinux .venv/lib/python2.7/site-packages
cp /usr/lib64/python2.7/site-packages/_selinux.so .venv/lib/python2.7/site-packages

As of March 12 2019 there is a published shim package for selinux modules: https://pypi.org/project/selinux/

pip install selinux should now fix this issue instead of copying /usr/lib/python*/site-packages/selinux to your virtual environments.

I was able to build a working molecule 2.20.1 testing environment with:

pip install testinfra==3.0.5 molecule ansible docker selinux

@dj-wasabi Na, the host already had libselinux-python already installed. Here’s a more detailed explanation of what went wrong.