2

When molecule is run on travis, the build is successful:

$ molecule test
--> Validating schema /home/travis/build/030/ansible-firefox/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 /home/travis/build/030/ansible-firefox/...
Lint completed successfully.
--> Executing Flake8 on files found in /home/travis/build/030/ansible-firefox/molecule/default/tests/...
Lint completed successfully.
--> Executing Ansible Lint on /home/travis/build/030/ansible-firefox/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: 'dependency'
Skipping, missing the requirements file.
--> Scenario: 'default'
--> Action: 'syntax'

    playbook: /home/travis/build/030/ansible-firefox/molecule/default/playbook.yml

--> Scenario: 'default'
--> Action: 'create'

    PLAY [Create] ******************************************************************

    TASK [Log into a Docker registry] **********************************************
    skipping: [localhost] => (item=None) 

    TASK [Create Dockerfiles from image names] *************************************
    changed: [localhost] => (item=None)
    changed: [localhost]

    TASK [Discover local Docker images] ********************************************
    ok: [localhost] => (item=None)
    ok: [localhost]

    TASK [Build an Ansible compatible image] ***************************************
    changed: [localhost] => (item=None)
    changed: [localhost]

    TASK [Create docker network(s)] ************************************************

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

    TASK [Wait for instance(s) creation to complete] *******************************
    changed: [localhost] => (item=None)
    changed: [localhost]

    PLAY RECAP *********************************************************************
    localhost                  : ok=5    changed=4    unreachable=0    failed=0


--> Scenario: 'default'
--> Action: 'prepare'
Skipping, prepare playbook not configured.
--> Scenario: 'default'
--> Action: 'converge'

    PLAY [Converge] ****************************************************************

    TASK [Gathering Facts] *********************************************************
    ok: [instance]

    TASK [ansible-firefox : Download.] *********************************************
    changed: [instance]

    TASK [ansible-firefox : remove the Firefox package] ****************************
    ok: [instance]

    TASK [ansible-firefox : Dependencies.] *****************************************
    changed: [instance] => (item=bzip2)
    changed: [instance] => (item=gtk3)
    changed: [instance] => (item=libXt)

    TASK [ansible-firefox : Create directory.] *************************************
    changed: [instance]

    TASK [ansible-firefox : Unarchive.] ********************************************
    changed: [instance]

    TASK [ansible-firefox : Symlink.] **********************************************
    changed: [instance]

    TASK [ansible-firefox : Create icons directory.] *******************************
    skipping: [instance]

    TASK [ansible-firefox : Copy firefox logo.] ************************************
    skipping: [instance]

    TASK [ansible-firefox : Create desktop icon.] **********************************
    skipping: [instance]

    RUNNING HANDLER [ansible-firefox : Check version.] *****************************
    changed: [instance]

    PLAY RECAP *********************************************************************
    instance                   : ok=8    changed=6    unreachable=0    failed=0


--> Scenario: 'default'
--> Action: 'idempotence'
Idempotence completed successfully.
--> Scenario: 'default'
--> Action: 'side_effect'
Skipping, side effect playbook not configured.
--> Scenario: 'default'
--> Action: 'verify'
--> Executing Testinfra tests found in /home/travis/build/030/ansible-firefox/molecule/default/tests/...
    ============================= test session starts ==============================
    platform linux2 -- Python 2.7.14, pytest-3.3.0, py-1.5.2, pluggy-0.6.0
    rootdir: /home/travis/build/030/ansible-firefox/molecule/default, inifile:
    plugins: testinfra-1.16.0
collected 1 item                                                               

    tests/test_default.py .                                                  [100%]

    =========================== 1 passed in 4.16 seconds ===========================
Verifier 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] *******************************
    changed: [localhost] => (item=None)
    changed: [localhost]

    TASK [Delete docker network(s)] ************************************************

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


The command "molecule test" exited with 0.
Done. Your build exited with 0.

When run locally, it is able to test, but it fails on the last step:

[username@localhost ansible-firefox]$ docker run --rm -it -v $(pwd):/tmp/$(basename "${PWD}") -w /tmp/$(basename "${PWD}") retr0h/molecule:latest molecule test
--> Validating schema /tmp/ansible-firefox/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 /tmp/ansible-firefox/...
Lint completed successfully.
--> Executing Flake8 on files found in /tmp/ansible-firefox/molecule/default/tests/...
Lint completed successfully.
--> Executing Ansible Lint on /tmp/ansible-firefox/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:

How do other people run molecule inside docker on their local machines?

  • 1
    I haven't tested it, but this should be a job for Docker-in-docker. You need to be able to run the container with --privileged. For what it's worth, I consider this a bad idea, since it's very easy to end up with corrupt data or other problems... but it's technically feasible. You may need to change the driver/docker.py bit of molecule to start the containers properly. – Bruce Becker Nov 11 '18 at 14:36
0

Your molecule run is failing in a very early stage, when it first tries to delete a possibly existing container before starting everything over.

Since you have a default configuration and your make a normal run of molecule, there is absolutely no valuable output in your log.

You have to run molecule in --debug mode to get something usable. And I'd bet a case of champagne that the error you will see poping out is that ansible is not able to find docker or docker-py.

If I'm right, your solution will then be pip install docker

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.