molecule: Latest molecule image fails at destroy

Issue Type

  • Bug report

Molecule and Ansible details

This issue is in the latest docker image of molecule.

quay.io/ansible/molecule                                    latest              502e06e6a9ac        4 hours ago         499 MB

Molecule installation method (one of):

  • docker

Ansible installation method (one of):

  • OS package

Detail any linters or test runners used:

Our molecule.yml file

---
dependency:
  name: galaxy

driver:
  name: docker

lint:
  name: yamllint

platforms:
  - name: instance
    image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
    command: ${MOLECULE_DOCKER_COMMAND:-""}
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
    privileged: true
    pre_build_image: true

provisioner:
  name: ansible
  lint:
    name: ansible-lint
  playbooks:
    converge: ${MOLECULE_PLAYBOOK:-playbook.yml}

scenario:
  name: default
  test_sequence:
    - lint
    - destroy
    # - dependency
    - syntax
    - create
    # - prepare
    - converge
    - idempotence
    # - side_effect
    - verify
    - destroy

verifier:
  name: testinfra
  options:
    vv: true
  lint:
    name: flake8

Desired Behavior

The desired behavior is that a molecule test would succeed on the initial destroy operation.

Actual Behaviour

Output from running molecule test

$ docker run --rm -v $(pwd):/tmp/$(basename "${PWD}"):z -v /var/run/docker.sock:/var/run/docker.sock -w /tmp/$(basename "${PWD}") quay.io/ansible/molecule:latest sudo molecule test
--> Validating schema /tmp/docker/molecule/default/molecule.yml.
Validation completed successfully.
--> Test matrix
    
└── default
    ├── lint
    ├── destroy
    ├── syntax
    ├── create
    ├── converge
    ├── idempotence
    ├── verify
    └── destroy
    
--> Scenario: 'default'
--> Action: 'lint'
--> Executing Yamllint on files found in /tmp/docker/...
Lint completed successfully.
--> Executing Flake8 on files found in /tmp/docker/molecule/default/tests/...
Lint completed successfully.
--> Executing Ansible Lint on /tmp/docker/molecule/default/playbook.yml...
Lint completed successfully.
--> Scenario: 'default'
--> Action: 'destroy'
    
    PLAY [Destroy] *****************************************************************
    
    TASK [Destroy molecule instance(s)] ********************************************
    changed: [localhost] => (item=None)
    changed: [localhost]
    
    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}
    fatal: [localhost]: FAILED! => {"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 occurred during the test sequence action: 'destroy'. Cleaning up.
--> Scenario: 'default'
--> Action: 'destroy'
    
    PLAY [Destroy] *****************************************************************
    
    TASK [Destroy molecule instance(s)] ********************************************
    changed: [localhost] => (item=None)
    changed: [localhost]
    
    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}
    fatal: [localhost]: FAILED! => {"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: 

This does not occur with an image from 3 weeks ago with the hash of e72db41d7ece. See the below snippet.

$ docker run --rm -v $(pwd):/tmp/$(basename "${PWD}"):z -v /var/run/docker.sock:/var/run/docker.sock -w /tmp/$(basename "${PWD}") quay.io/ansible/molecule:e72db41d7ece sudo molecule test
--> Validating schema /tmp/docker/molecule/default/molecule.yml.
Validation completed successfully.
--> Test matrix
    
└── default
    ├── lint
    ├── destroy
    ├── syntax
    ├── create
    ├── converge
    ├── idempotence
    ├── verify
    └── destroy
    
--> Scenario: 'default'
--> Action: 'lint'
--> Executing Yamllint on files found in /tmp/docker/...
Lint completed successfully.
--> Executing Flake8 on files found in /tmp/docker/molecule/default/tests/...
Lint completed successfully.
--> Executing Ansible Lint on /tmp/docker/molecule/default/playbook.yml...
Lint completed successfully.
--> Scenario: 'default'
--> Action: 'destroy'
    
    PLAY [Destroy] *****************************************************************
    
    TASK [Destroy molecule instance(s)] ********************************************
    changed: [localhost] => (item=None)
    changed: [localhost]
    
    TASK [Wait for instance(s) deletion to complete] *******************************
    ok: [localhost] => (item=None)
    ok: [localhost]
    
    TASK [Delete docker network(s)] ************************************************
    
    PLAY RECAP *********************************************************************
    localhost                  : ok=2    changed=1    unreachable=0    failed=0
    
    
--> Scenario: 'default'
--> Action: 'syntax'

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 16 (3 by maintainers)

Most upvoted comments

In the Dockerfile, find the PIP_PACKAGES line

ENV PIP_PACKAGES="\
    molecule[azure,docker,docs,ec2,gce,lxc,openstack,vagrant,windows] \
    virtualenv \
"

and add docker to it:

ENV PIP_PACKAGES="\
    molecule[azure,docker,docs,ec2,gce,lxc,openstack,vagrant,windows] \
    virtualenv docker \
"

This is quite a simple fix.