Repository: ansible/molecule

Issue:
molecule 2.0.0.0rc11 does not work with vagrant driver
# Issue Type

- Bug report

# Installation details

```
vagrant --version
Vagrant 1.9.5

```
virtualbox --help
Oracle VM VirtualBox Manager 5.0.40_Ubuntu
```
vagrant --version
Vagrant 1.9.5

```

```
ansible --version
ansible 2.3.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]
```

```
molecule --version
molecule, version 2.0.0.0rc11
```

- Molecule installation method: `sudo -H pip install molecule --pre`
- Ansible installation method: from ppa: `ansible/xenial,xenial,now 2.3.1.0-1ppa~xenial all [installed]`

# Desired Behaviour

Example works out-of-the-box

# Actual Behaviour (Bug report only)

Following the steps:

```
molecule init role --role-name foo --driver-name vagrant
cd foo
molecule --debug test 
```

Output:
```
--> Scenario: [default]
--> Provisioner: [ansible]
--> Driver: [vagrant]
--> Playbook: [create.yml]
DEBUG: ANSIBLE ENVIRONMENT
---
ANSIBLE_CONFIG: /home/cyrille/code/Deployment/foo/molecule/default/.molecule/ansible.cfg
ANSIBLE_FILTER_PLUGINS: /usr/local/lib/python2.7/dist-packages/molecule/provisioner/ansible/plugins/filters:/home/cyrille/code/Deployment/foo/plugins/filters:/home/cyrille/code/Deployment/foo/molecule/default/.molecule/plugins/filters
ANSIBLE_LIBRARY: /usr/local/lib/python2.7/dist-packages/molecule/provisioner/ansible/plugins/libraries:/home/cyrille/code/Deployment/foo/library:/home/cyrille/code/Deployment/foo/molecule/default/.molecule/library
ANSIBLE_ROLES_PATH: /home/cyrille/code/Deployment:/home/cyrille/code/Deployment/foo/molecule/default/.molecule/roles

DEBUG: MOLECULE ENVIRONMENT
---
MOLECULE_DEPENDENCY_NAME: galaxy
MOLECULE_DRIVER_NAME: vagrant
MOLECULE_EPHEMERAL_DIRECTORY: /home/cyrille/code/Deployment/foo/molecule/default/.molecule
MOLECULE_FILE: /home/cyrille/code/Deployment/foo/molecule/default/molecule.yml
MOLECULE_INSTANCE_CONFIG: /home/cyrille/code/Deployment/foo/molecule/default/.molecule/instance_config.yml
MOLECULE_INVENTORY_FILE: /home/cyrille/code/Deployment/foo/molecule/default/.molecule/ansible_inventory.yml
MOLECULE_LINT_NAME: yamllint
MOLECULE_PROVISIONER_NAME: ansible
MOLECULE_SCENARIO_DIRECTORY: /home/cyrille/code/Deployment/foo/molecule/default
MOLECULE_SCENARIO_NAME: default
MOLECULE_VERIFIER_NAME: testinfra

DEBUG: COMMAND
/usr/bin/ansible-playbook --inventory=/home/cyrille/code/Deployment/foo/molecule/default/.molecule/ansible_inventory.yml /home/cyrille/code/Deployment/foo/molecule/default/create.yml -vvv
    Using /home/cyrille/code/Deployment/foo/molecule/default/.molecule/ansible.cfg as config file
    
    PLAYBOOK: create.yml ***********************************************************
    1 plays in /home/cyrille/code/Deployment/foo/molecule/default/create.yml
    
    PLAY [localhost] ***************************************************************
    
    TASK [Gathering Facts] *********************************************************
    Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/setup.py
    <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: cyrille
    <127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/cyrille/.ansible/tmp/ansible-tmp-1499696213.85-162896029230166 `" && echo ansible-tmp-1499696213.85-162896029230166="` echo /home/cyrille/.ansible/tmp/ansible-tmp-1499696213.85-162896029230166 `" ) && sleep 0'
    <127.0.0.1> PUT /tmp/tmpjH8ts3 TO /home/cyrille/.ansible/tmp/ansible-tmp-1499696213.85-162896029230166/setup.py
    <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/cyrille/.ansible/tmp/ansible-tmp-1499696213.85-162896029230166/ /home/cyrille/.ansible/tmp/ansible-tmp-1499696213.85-162896029230166/setup.py && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python /home/cyrille/.ansible/tmp/ansible-tmp-1499696213.85-162896029230166/setup.py; rm -rf "/home/cyrille/.ansible/tmp/ansible-tmp-1499696213.85-162896029230166/" > /dev/null 2>&1 && sleep 0'
    ok: [localhost]
    META: ran handlers
    
    TASK [Create molecule instance(s)] *********************************************
    task path: /home/cyrille/code/Deployment/foo/molecule/default/create.yml:9
    Using module file /usr/local/lib/python2.7/dist-packages/molecule/provisioner/ansible/plugins/libraries/molecule_vagrant.py
    <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: cyrille
    <127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/cyrille/.ansible/tmp/ansible-tmp-1499696214.29-238011153605944 `" && echo ansible-tmp-1499696214.29-238011153605944="` echo /home/cyrille/.ansible/tmp/ansible-tmp-1499696214.29-238011153605944 `" ) && sleep 0'
    <127.0.0.1> PUT /tmp/tmpvjh9_H TO /home/cyrille/.ansible/tmp/ansible-tmp-1499696214.29-238011153605944/molecule_vagrant.py
    <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/cyrille/.ansible/tmp/ansible-tmp-1499696214.29-238011153605944/ /home/cyrille/.ansible/tmp/ansible-tmp-1499696214.29-238011153605944/molecule_vagrant.py && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python /home/cyrille/.ansible/tmp/ansible-tmp-1499696214.29-238011153605944/molecule_vagrant.py; rm -rf "/home/cyrille/.ansible/tmp/ansible-tmp-1499696214.29-238011153605944/" > /dev/null 2>&1 && sleep 0'
    failed: [localhost] (item={'box': u'ubuntu/xenial64', 'name': u'instance-1'}) => {
        "failed": true, 
        "item": {
            "box": "ubuntu/xenial64", 
            "name": "instance-1"
        }, 
        "module_stderr": "", 
        "module_stdout": "Bringing machine 'instance-1-default' up with 'virtualbox' provider...\n==> instance-1-default: Cloning VM...\n\r\u001b[K==> instance-1-default: Matching MAC address for NAT networking...\n==> instance-1-default: Checking if box 'ubuntu/xenial64' is up to date...\n==> instance-1-default: Setting the name of the VM: molecule_instance-1-default_1499696219629_3817\n==> instance-1-default: Clearing any previously set network interfaces...\n==> instance-1-default: Preparing network interfaces based on configuration...\n    instance-1-default: Adapter 1: nat\n==> instance-1-default: Forwarding ports...\n    instance-1-default: 22 (guest) => 2222 (host) (adapter 1)\n==> instance-1-default: Running 'pre-boot' VM customizations...\n==> instance-1-default: Booting VM...\n==> instance-1-default: Waiting for machine to boot. This may take a few minutes...\n    instance-1-default: SSH address: 127.0.0.1:2222\n    instance-1-default: SSH username: ubuntu\n    instance-1-default: SSH auth method: password\n    instance-1-default: \n    instance-1-default: Inserting generated public key within guest...\n    instance-1-default: Removing insecure key from the guest if it's present...\n    instance-1-default: Key inserted! Disconnecting and reconnecting using new SSH key...\n==> instance-1-default: Machine booted and ready!\n[instance-1-default] GuestAdditions 5.0.40 running --- OK.\n==> instance-1-default: Checking for guest additions in VM...\n==> instance-1-default: Setting hostname...\n==> instance-1-default: Mounting shared folders...\n    instance-1-default: /vagrant => /home/cyrille/code/Deployment/foo/molecule/default/.molecule\n==> instance-1-default: Machine not provisioned because `--no-provision` is specified.\n\n{\"IdentityFile\": \"/home/cyrille/code/Deployment/foo/molecule/default/.molecule/.vagrant/machines/instance-1-default/virtualbox/private_key\", \"changed\": true, \"LogLevel\": \"FATAL\", \"HostName\": \"127.0.0.1\", \"Host\": \"instance-1-default\", \"PasswordAuthentication\": \"no\", \"IdentitiesOnly\": \"yes\", \"UserKnownHostsFile\": \"/dev/null\", \"User\": \"ubuntu\", \"invocation\": {\"module_args\": {\"platform_box_url\": null, \"provider_cpus\": 2, \"provider_raw_config_args\": null, \"platform_box\": \"ubuntu/xenial64\", \"state\": \"up\", \"instance_interfaces\": [], \"instance_name\": \"instance-1-default\", \"platform_box_version\": null, \"provider_memory\": 512, \"instance_raw_config_args\": null, \"provider_options\": {}, \"provider_name\": \"virtualbox\"}}, \"StrictHostKeyChecking\": \"no\", \"Port\": \"2222\"}\n", 
        "msg": "MODULE FAILURE", 
        "rc": 0
    }
    
    PLAY RECAP *********************************************************************
    localhost                  : ok=1    changed=0    unreachable=0    failed=1   
    
    
ERROR: 

```


Discussion:
I cannot reproduce... 

```
$ molecule --version
molecule, version 2.0.0.0rc11
``` 

My venv did have an issue initially b/c `python-vagrant` was not installed.  However, once I installed that, all was good.
Hi @retr0h 

Could you please share the details on how you have tested it ?
If it works with you, then It is probably something stupid that I have neglected.

Here is my test setup:
https://github.com/cyrilleverrier/ansible-role-foo
I can reproduce it with `make test`

It seems that the failure comes from the newly generated private key to access the vagrant box.
But I don't see anything wrong with it. The generated private key is part of the creation of the Vagrant box.

The debug log output is:
```
Bringing machine 'instance' up with 'virtualbox' provider...
==> instance: Preparing master VM for linked clones...
    instance: This is a one time operation. Once the master VM is prepared,
    instance: it will be used as a base for linked clones, making the creation
    instance: of new VMs take milliseconds on a modern system.
==> instance: Importing base box 'bento/centos-7.3'...
Progress: 20%
Progress: 30%
Progress: 50%
Progress: 70%
Progress: 90%
==> instance: Cloning VM...
==> instance: Matching MAC address for NAT networking...
==> instance: Checking if box 'bento/centos-7.3' is up to date...
==> instance: Setting the name of the VM: molecule_instance_1499846363830_65126
==> instance: Clearing any previously set network interfaces...
==> instance: Preparing network interfaces based on configuration...
    instance: Adapter 1: nat
==> instance: Forwarding ports...
    instance: 22 (guest) => 2222 (host) (adapter 1)
==> instance: Running 'pre-boot' VM customizations...
==> instance: Booting VM...
==> instance: Waiting for machine to boot. This may take a few minutes...
    instance: SSH address: 127.0.0.1:2222
        instance: SSH username: vagrant
        instance: SSH auth method: private key
        instance: Warning: Remote connection disconnect. Retrying...
        instance: 
        instance: Vagrant insecure key detected. Vagrant will automatically replace
        instance: this with a newly generated keypair for better security.
        instance: 
        instance: Inserting generated public key within guest...
        instance: Removing insecure key from the guest if it's present...
        instance: Key inserted! Disconnecting and reconnecting using new SSH key...
==> instance: Machine booted and ready!
[instance] GuestAdditions 5.1.22 running --- OK.
==> instance: Checking for guest additions in VM...
==> instance: Setting hostname...
==> instance: Mounting shared folders...
    instance: /vagrant => /home/cyrille/code/Deployment/ansible-role-foo/molecule/default/.molecule
==> instance: Machine not provisioned because `--no-provision` is specified.

{
    "IdentityFile": "/home/cyrille/code/Deployment/ansible-role-foo/molecule/default/.molecule/.vagrant/machines/instance/virtualbox/private_key",
    "changed": true, 
    "LogLevel": "FATAL", 
    "HostName": "127.0.0.1",
    "Host": "instance",
    "PasswordAuthentication": "no",
    "IdentitiesOnly": "yes",
    "UserKnownHostsFile": "/dev/null",
    "User": "vagrant",
    "invocation": {
        "module_args": {
            "platform_box_url": null,
            "provider_cpus": 2,
            "provider_raw_config_args": null,
            "platform_box": "bento/centos-7.3",
            "state": "up",
            "instance_interfaces": [],
            "instance_name": "instance",
            "platform_box_version": null,
            "provider_memory": 512,
            "instance_raw_config_args": null,
            "provider_options": {},
            "provider_name": "virtualbox",
            "force_stop": false
        },
        "StrictHostKeyChecking": "no",
        "Port": "2222"
    }",
    "msg": "MODULE FAILURE",
    "rc": 0
}
```

And thank you for your useful testing tool.


Hi @cyrilleverrier 

I tested by simply going into Molecules functional test scenarios directory and running from there.  I am using the current master version of Molecule however.

```
$ cd test/scenarios/driver/vagrant
$ molecule test
--> Scenario: [default]
--> Provisioner: [ansible]
--> Playbook: [destroy.yml]

    PLAY [Teardown] ****************************************************************

    TASK [Destroy molecule instance(s)] ********************************************
    ok: [localhost] => (item=(censored due to no_log))

    TASK [Populate instance config] ************************************************
    ok: [localhost]

    TASK [Dump instance config] ****************************************************
    skipping: [localhost]

    PLAY RECAP *********************************************************************
    localhost                  : ok=2    changed=0    unreachable=0    failed=0


--> Scenario: [default]
--> Dependency: [galaxy]
Skipping, missing the requirements file.
--> Scenario: [default]
--> Provisioner: [ansible]
--> Syntax Verification of Playbook: [playbook.yml]

    playbook: /Users/jodewey/git/molecule_2/test/scenarios/driver/vagrant/molecule/default/playbook.yml

--> Scenario: [default]
--> Provisioner: [ansible]
--> Driver: [vagrant]
--> Playbook: [create.yml]

    PLAY [Setup] *******************************************************************

    TASK [Create molecule instance(s)] *********************************************
    changed: [localhost] => (item=(censored due to no_log))

    TASK [Populate instance config dict] *******************************************
    ok: [localhost] => (item=(censored due to no_log))

    TASK [Convert instance config dict to a list] **********************************
    ok: [localhost]

    TASK [Dump instance config] ****************************************************
    changed: [localhost]

    PLAY RECAP *********************************************************************
    localhost                  : ok=4    changed=2    unreachable=0    failed=0
--> Scenario: [default]
--> Provisioner: [ansible]
--> Playbook: [playbook.yml]

    PLAY [Converge] ****************************************************************

    TASK [Gathering Facts] *********************************************************
    ok: [instance]

    TASK [molecule : Create /etc/molecule] *****************************************
    changed: [instance]

    TASK [molecule : Create /etc/molecule/instance] ********************************
    changed: [instance]

    PLAY RECAP *********************************************************************
    instance                   : ok=3    changed=2    unreachable=0    failed=0


--> Scenario: [default]
--> Provisioner: [ansible]
--> Idempotence Verification of Playbook: [playbook.yml]
Idempotence completed successfully.
--> Scenario: [default]
--> Lint: [yamllint,flake8,ansible-lint]
--> Executing Yamllint on files found in /Users/jodewey/git/molecule_2/test/scenarios/driver/vagrant/...
Lint completed successfully.
--> Executing Flake8 on files found in /Users/jodewey/git/molecule_2/test/scenarios/driver/vagrant/molecule/default/tests/...
Lint completed successfully.
--> Executing Ansible Lint on /Users/jodewey/git/molecule_2/test/scenarios/driver/vagrant/molecule/default/playbook.yml...
Lint completed successfully.
--> Scenario: [default]
--> Provisioner: [ansible]
Skipping, destruct playbook not configured.
--> Scenario: [default]
--> Verifier: [testinfra]
--> Executing Testinfra tests found in /Users/jodewey/git/molecule_2/test/scenarios/driver/vagrant/molecule/default/tests/...
    ============================= test session starts ==============================
    platform darwin -- Python 2.7.13, pytest-3.0.7, py-1.4.33, pluggy-0.4.0
    rootdir: /Users/jodewey/git/molecule_2, inifile: pytest.ini
    plugins: testinfra-1.6.0, verbose-parametrize-1.2.2, mock-1.6.0, helpers-namespace-2016.7.10, cov-2.4.0
collected 4 itemss

    tests/test_default.py ....

    ============================ pytest-warning summary ============================
    WP1 None Module already imported so can not be re-written: testinfra
    ================= 4 passed, 1 pytest-warnings in 3.87 seconds ==================
Verifier completed successfully.
--> Scenario: [default]
--> Provisioner: [ansible]
--> Playbook: [destroy.yml]

    PLAY [Teardown] ****************************************************************

    TASK [Destroy molecule instance(s)] ********************************************
    changed: [localhost] => (item=(censored due to no_log))

    TASK [Populate instance config] ************************************************
    ok: [localhost]

    TASK [Dump instance config] ****************************************************
    changed: [localhost]

    PLAY RECAP *********************************************************************
    localhost                  : ok=3    changed=2    unreachable=0    failed=0
```
Hi @retr0h 

Thank you for your reply.

I tried the same test and it failed on my machine.

## Host machine
```
Ubuntu 16.04.2 LTS
Vagrant 1.9.5 
Virtualbox Version 5.1.22 r115126 (Qt5.5.1)
Python 2.7.12
```
## Steps to reproduce:
```
 git clone git@github.com:metacloud/molecule.git 
cd test/scenarios/driver/vagrant

mkvirtualenv .venv
pip install git+ssh://git@github.com/metacloud/molecule.git@master
pip install python-vagrant==0.5.15
pip install yamllint==1.8.1

molecule test
```

## Output:
```
(.venv) ➜  vagrant git:(master) molecule --debug test
--> Scenario: [default]
--> Provisioner: [ansible]
--> Playbook: [destroy.yml]
    Using /home/cyrille/code/test/molecule/test/scenarios/driver/vagrant/molecule/default/.molecule/ansible.cfg as config file
    
    PLAYBOOK: destroy.yml **********************************************************
    1 plays in /home/cyrille/code/test/molecule/test/resources/playbooks/vagrant/destroy.yml
    
    PLAY [Teardown] ****************************************************************
    META: ran handlers
    
    TASK [Destroy molecule instance(s)] ********************************************
    task path: /home/cyrille/code/test/molecule/test/resources/playbooks/vagrant/destroy.yml:12
    Using module file /home/cyrille/.virtualenvs/.venv/lib/python2.7/site-packages/molecule/provisioner/ansible/plugins/libraries/molecule_vagrant.py
    <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: cyrille
    <127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/cyrille/.ansible/tmp/ansible-tmp-1499928366.69-231173101678897 `" && echo ansible-tmp-1499928366.69-231173101678897="` echo /home/cyrille/.ansible/tmp/ansible-tmp-1499928366.69-231173101678897 `" ) && sleep 0'
    <127.0.0.1> PUT /tmp/tmpoyqrmi TO /home/cyrille/.ansible/tmp/ansible-tmp-1499928366.69-231173101678897/molecule_vagrant.py
    <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/cyrille/.ansible/tmp/ansible-tmp-1499928366.69-231173101678897/ /home/cyrille/.ansible/tmp/ansible-tmp-1499928366.69-231173101678897/molecule_vagrant.py && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c '/home/cyrille/.virtualenvs/.venv/bin/python2 /home/cyrille/.ansible/tmp/ansible-tmp-1499928366.69-231173101678897/molecule_vagrant.py; rm -rf "/home/cyrille/.ansible/tmp/ansible-tmp-1499928366.69-231173101678897/" > /dev/null 2>&1 && sleep 0'
    changed: [localhost] => (item={'box': u'debian/jessie64', 'interfaces': [{'auto_config': True, 'network_name': u'private_network', 'type': u'dhcp'}], 'name': u'instance'}) => {
        "changed": true, 
        "invocation": {
            "module_args": {
                "force_stop": true, 
                "instance_interfaces": [], 
                "instance_name": "instance", 
                "instance_raw_config_args": null, 
                "platform_box": "debian/jessie64", 
                "platform_box_url": null, 
                "platform_box_version": null, 
                "provider_cpus": 2, 
                "provider_memory": 512, 
                "provider_name": "virtualbox", 
                "provider_options": {}, 
                "provider_raw_config_args": null, 
                "state": "destroy"
            }
        }, 
        "item": {
            "box": "debian/jessie64", 
            "interfaces": [
                {
                    "auto_config": true, 
                    "network_name": "private_network", 
                    "type": "dhcp"
                }
            ], 
            "name": "instance"
        }
    }
    
    TASK [Populate instance config] ************************************************
    task path: /home/cyrille/code/test/molecule/test/resources/playbooks/vagrant/destroy.yml:23
    ok: [localhost] => {
        "ansible_facts": {
            "instance_conf": {}
        }, 
        "changed": false
    }
    
    TASK [Dump instance config] ****************************************************
    task path: /home/cyrille/code/test/molecule/test/resources/playbooks/vagrant/destroy.yml:27
    Using module file /home/cyrille/.virtualenvs/.venv/local/lib/python2.7/site-packages/ansible/modules/files/stat.py
    <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: cyrille
    <127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.7-221473015342692 `" && echo ansible-tmp-1499928374.7-221473015342692="` echo /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.7-221473015342692 `" ) && sleep 0'
    <127.0.0.1> PUT /tmp/tmp0ZR4ZJ TO /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.7-221473015342692/stat.py
    <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.7-221473015342692/ /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.7-221473015342692/stat.py && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c '/home/cyrille/.virtualenvs/.venv/bin/python2 /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.7-221473015342692/stat.py; rm -rf "/home/cyrille/.ansible/tmp/ansible-tmp-1499928374.7-221473015342692/" > /dev/null 2>&1 && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.77-20066209859643 `" && echo ansible-tmp-1499928374.77-20066209859643="` echo /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.77-20066209859643 `" ) && sleep 0'
    <127.0.0.1> PUT /tmp/tmpj2f6L8 TO /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.77-20066209859643/source
    <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.77-20066209859643/ /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.77-20066209859643/source && sleep 0'
    Using module file /home/cyrille/.virtualenvs/.venv/local/lib/python2.7/site-packages/ansible/modules/files/copy.py
    <127.0.0.1> PUT /tmp/tmpiUjyju TO /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.77-20066209859643/copy.py
    <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.77-20066209859643/ /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.77-20066209859643/copy.py && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c '/home/cyrille/.virtualenvs/.venv/bin/python2 /home/cyrille/.ansible/tmp/ansible-tmp-1499928374.77-20066209859643/copy.py; rm -rf "/home/cyrille/.ansible/tmp/ansible-tmp-1499928374.77-20066209859643/" > /dev/null 2>&1 && sleep 0'
    changed: [localhost] => {
        "changed": true, 
        "checksum": "a28bd8905f58a8ef76241b09ae1b0a9df5d8604e", 
        "dest": "/home/cyrille/code/test/molecule/test/scenarios/driver/vagrant/molecule/default/.molecule/instance_config.yml", 
        "gid": 1000, 
        "group": "cyrille", 
        "invocation": {
            "module_args": {
                "attributes": null, 
                "backup": false, 
                "content": null, 
                "delimiter": null, 
                "dest": "/home/cyrille/code/test/molecule/test/scenarios/driver/vagrant/molecule/default/.molecule/instance_config.yml", 
                "directory_mode": null, 
                "follow": false, 
                "force": true, 
                "group": null, 
                "mode": null, 
                "original_basename": "tmpj2f6L8", 
                "owner": null, 
                "regexp": null, 
                "remote_src": null, 
                "selevel": null, 
                "serole": null, 
                "setype": null, 
                "seuser": null, 
                "src": "/home/cyrille/.ansible/tmp/ansible-tmp-1499928374.77-20066209859643/source", 
                "unsafe_writes": null, 
                "validate": null
            }
        }, 
        "md5sum": "207e63ce322611b6adffa5ab78fb076a", 
        "mode": "0664", 
        "owner": "cyrille", 
        "size": 27, 
        "src": "/home/cyrille/.ansible/tmp/ansible-tmp-1499928374.77-20066209859643/source", 
        "state": "file", 
        "uid": 1000
    }
    META: ran handlers
    META: ran handlers
    
    PLAY RECAP *********************************************************************
    localhost                  : ok=3    changed=2    unreachable=0    failed=0
    
    
--> Scenario: [default]
--> Dependency: [galaxy]
Skipping, missing the requirements file.
--> Scenario: [default]
--> Provisioner: [ansible]
--> Syntax Verification of Playbook: [playbook.yml]
    Using /home/cyrille/code/test/molecule/test/scenarios/driver/vagrant/molecule/default/.molecule/ansible.cfg as config file
    1 plays in /home/cyrille/code/test/molecule/test/scenarios/driver/vagrant/molecule/default/playbook.yml
    
    playbook: /home/cyrille/code/test/molecule/test/scenarios/driver/vagrant/molecule/default/playbook.yml
    
--> Scenario: [default]
--> Provisioner: [ansible]
--> Driver: [vagrant]
--> Playbook: [create.yml]
    Using /home/cyrille/code/test/molecule/test/scenarios/driver/vagrant/molecule/default/.molecule/ansible.cfg as config file
    
    PLAYBOOK: create.yml ***********************************************************
    1 plays in /home/cyrille/code/test/molecule/test/resources/playbooks/vagrant/create.yml
    
    PLAY [Setup] *******************************************************************
    META: ran handlers
    
    TASK [Create molecule instance(s)] *********************************************
    task path: /home/cyrille/code/test/molecule/test/resources/playbooks/vagrant/create.yml:12
    Using module file /home/cyrille/.virtualenvs/.venv/lib/python2.7/site-packages/molecule/provisioner/ansible/plugins/libraries/molecule_vagrant.py
    <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: cyrille
    <127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/cyrille/.ansible/tmp/ansible-tmp-1499928375.75-215016751864938 `" && echo ansible-tmp-1499928375.75-215016751864938="` echo /home/cyrille/.ansible/tmp/ansible-tmp-1499928375.75-215016751864938 `" ) && sleep 0'
    <127.0.0.1> PUT /tmp/tmpgLmcGm TO /home/cyrille/.ansible/tmp/ansible-tmp-1499928375.75-215016751864938/molecule_vagrant.py
    <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/cyrille/.ansible/tmp/ansible-tmp-1499928375.75-215016751864938/ /home/cyrille/.ansible/tmp/ansible-tmp-1499928375.75-215016751864938/molecule_vagrant.py && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c '/home/cyrille/.virtualenvs/.venv/bin/python2 /home/cyrille/.ansible/tmp/ansible-tmp-1499928375.75-215016751864938/molecule_vagrant.py; rm -rf "/home/cyrille/.ansible/tmp/ansible-tmp-1499928375.75-215016751864938/" > /dev/null 2>&1 && sleep 0'
 [WARNING]: Module invocation had junk after the JSON data: dpkg-preconfigure:
unable to re-open stdin: No such file or directory Fetched 40.4 MB in 6s (6,063
kB/s) Selecting previously unselected package libasan0:amd64. (Reading database
...  (Reading database ... 5% (Reading database ... 10% (Reading database ...
15% (Reading database ... 20% (Reading database ... 25% (Reading database ...
30% (Reading database ... 35% (Reading database ... 40% (Reading database ...
45% (Reading database ... 50% (Reading database ... 55% (Reading database ...
60% (Reading database ... 65% (Reading database ... 70% (Reading database ...
75% (Reading database ... 80% (Reading database ... 85% (Reading database ...
90% (Reading database ... 95% (Reading database ... 100% (Reading database ...
28311 files and directories currently installed.) Preparing to unpack
.../libasan0_4.8.4-1_amd64.deb ... Unpacking libasan0:amd64 (4.8.4-1) ...
Selecting previously unselected package libasan1:amd64. Preparing to unpack
.../libasan1_4.9.2-10_amd64.deb ... Unpacking libasan1:amd64 (4.9.2-10) ...
Selecting previously unselected package libatomic1:amd64. Preparing to unpack
.../libatomic1_4.9.2-10_amd64.deb ... Unpacking libatomic1:amd64 (4.9.2-10) ...
Selecting previously unselected package libcilkrts5:amd64. Preparing to unpack
.../libcilkrts5_4.9.2-10_amd64.deb ... Unpacking libcilkrts5:amd64 (4.9.2-10)
... Selecting previously unselected package libisl10:amd64. Preparing to unpack
.../libisl10_0.12.2-2_amd64.deb ... Unpacking libisl10:amd64 (0.12.2-2) ...
Selecting previously unselected package libcloog-isl4:amd64. Preparing to
unpack .../libcloog-isl4_0.18.2-1+b2_amd64.deb ... Unpacking libcloog-
isl4:amd64 (0.18.2-1+b2) ... Selecting previously unselected package
libgomp1:amd64. Preparing to unpack .../libgomp1_4.9.2-10_amd64.deb ...
Unpacking libgomp1:amd64 (4.9.2-10) ... Selecting previously unselected package
libitm1:amd64. Preparing to unpack .../libitm1_4.9.2-10_amd64.deb ... Unpacking
libitm1:amd64 (4.9.2-10) ... Selecting previously unselected package
liblsan0:amd64. Preparing to unpack .../liblsan0_4.9.2-10_amd64.deb ...
Unpacking liblsan0:amd64 (4.9.2-10) ... Selecting previously unselected package
libmpfr4:amd64. Preparing to unpack .../libmpfr4_3.1.2-2_amd64.deb ...
Unpacking libmpfr4:amd64 (3.1.2-2) ... Selecting previously unselected package
libquadmath0:amd64. Preparing to unpack .../libquadmath0_4.9.2-10_amd64.deb ...
Unpacking libquadmath0:amd64 (4.9.2-10) ... Selecting previously unselected
package libtsan0:amd64. Preparing to unpack .../libtsan0_4.9.2-10_amd64.deb ...
Unpacking libtsan0:amd64 (4.9.2-10) ... Selecting previously unselected package
libubsan0:amd64. Preparing to unpack .../libubsan0_4.9.2-10_amd64.deb ...
Unpacking libubsan0:amd64 (4.9.2-10) ... Selecting previously unselected
package libmpc3:amd64. Preparing to unpack .../libmpc3_1.0.2-1_amd64.deb ...
Unpacking libmpc3:amd64 (1.0.2-1) ... Selecting previously unselected package
binutils. Preparing to unpack .../binutils_2.25-5+deb8u1_amd64.deb ...
Unpacking binutils (2.25-5+deb8u1) ... Selecting previously unselected package
cpp-4.9. Preparing to unpack .../cpp-4.9_4.9.2-10_amd64.deb ... Unpacking
cpp-4.9 (4.9.2-10) ... Selecting previously unselected package cpp. Preparing
to unpack .../cpp_4%3a4.9.2-2_amd64.deb ... Unpacking cpp (4:4.9.2-2) ...
Selecting previously unselected package cpp-4.8. Preparing to unpack
.../cpp-4.8_4.8.4-1_amd64.deb ... Unpacking cpp-4.8 (4.8.4-1) ... Selecting
previously unselected package libgcc-4.9-dev:amd64. Preparing to unpack
.../libgcc-4.9-dev_4.9.2-10_amd64.deb ... Unpacking libgcc-4.9-dev:amd64
(4.9.2-10) ... Selecting previously unselected package gcc-4.9. Preparing to
unpack .../gcc-4.9_4.9.2-10_amd64.deb ... Unpacking gcc-4.9 (4.9.2-10) ...
Selecting previously unselected package gcc. Preparing to unpack
.../gcc_4%3a4.9.2-2_amd64.deb ... Unpacking gcc (4:4.9.2-2) ... Selecting
previously unselected package make. Preparing to unpack
.../make_4.0-8.1_amd64.deb ... Unpacking make (4.0-8.1) ... Selecting
previously unselected package dkms. Preparing to unpack
.../dkms_2.2.0.3-2_all.deb ... Unpacking dkms (2.2.0.3-2) ... Selecting
previously unselected package libfakeroot:amd64. Preparing to unpack
.../libfakeroot_1.20.2-1_amd64.deb ... Unpacking libfakeroot:amd64 (1.20.2-1)
... Selecting previously unselected package fakeroot. Preparing to unpack
.../fakeroot_1.20.2-1_amd64.deb ... Unpacking fakeroot (1.20.2-1) ... Selecting
previously unselected package libgcc-4.8-dev:amd64. Preparing to unpack
.../libgcc-4.8-dev_4.8.4-1_amd64.deb ... Unpacking libgcc-4.8-dev:amd64
(4.8.4-1) ... Selecting previously unselected package gcc-4.8. Preparing to
unpack .../gcc-4.8_4.8.4-1_amd64.deb ... Unpacking gcc-4.8 (4.8.4-1) ...
Selecting previously unselected package libc-dev-bin. Preparing to unpack
.../libc-dev-bin_2.19-18+deb8u9_amd64.deb ... Unpacking libc-dev-bin
(2.19-18+deb8u9) ... Selecting previously unselected package linux-libc-
dev:amd64. Preparing to unpack .../linux-libc-dev_3.16.43-2_amd64.deb ...
Unpacking linux-libc-dev:amd64 (3.16.43-2) ... Selecting previously unselected
package libc6-dev:amd64. Preparing to unpack
.../libc6-dev_2.19-18+deb8u9_amd64.deb ... Unpacking libc6-dev:amd64
(2.19-18+deb8u9) ... Selecting previously unselected package linux-compiler-
gcc-4.8-x86. Preparing to unpack .../linux-compiler-
gcc-4.8-x86_3.16.43-2_amd64.deb ... Unpacking linux-compiler-gcc-4.8-x86
(3.16.43-2) ... Selecting previously unselected package linux-
headers-3.16.0-4-common. Preparing to unpack .../linux-
headers-3.16.0-4-common_3.16.43-2_amd64.deb ... Unpacking linux-
headers-3.16.0-4-common (3.16.43-2) ... Selecting previously unselected package
linux-kbuild-3.16. Preparing to unpack .../linux-
kbuild-3.16_3.16.7-ckt20-1_amd64.deb ... Unpacking linux-kbuild-3.16
(3.16.7-ckt20-1) ... Selecting previously unselected package linux-
headers-3.16.0-4-amd64. Preparing to unpack .../linux-
headers-3.16.0-4-amd64_3.16.43-2_amd64.deb ... Unpacking linux-
headers-3.16.0-4-amd64 (3.16.43-2) ... Selecting previously unselected package
linux-headers-amd64. Preparing to unpack .../linux-headers-
amd64_3.16+63_amd64.deb ... Unpacking linux-headers-amd64 (3.16+63) ...
Selecting previously unselected package manpages-dev. Preparing to unpack
.../manpages-dev_3.74-1_all.deb ... Unpacking manpages-dev (3.74-1) ...
Processing triggers for man-db (2.7.0.2-5) ... Setting up libasan0:amd64
(4.8.4-1) ... Setting up libasan1:amd64 (4.9.2-10) ... Setting up
    failed: [localhost] (item={'box': u'debian/jessie64', 'interfaces': [{'auto_config': True, 'network_name': u'private_network', 'type': u'dhcp'}], 'name': u'instance'}) => {
        "failed": true, 
        "item": {
            "box": "debian/jessie64", 
            "interfaces": [
                {
                    "auto_config": true, 
                    "network_name": "private_network", 
                    "type": "dhcp"
                }
            ], 
            "name": "instance"
        }, 
        "module_stderr": "", 
libatomic1:amd64 (4.9.2-10) ... Setting up libcilkrts5:amd64 (4.9.2-10) ...
Setting up libisl10:amd64 (0.12.2-2) ... Setting up libcloog-isl4:amd64
(0.18.2-1+b2) ... Setting up libgomp1:amd64 (4.9.2-10) ... Setting up
libitm1:amd64 (4.9.2-10) ... Setting up liblsan0:amd64 (4.9.2-10) ... Setting
up libmpfr4:amd64 (3.1.2-2) ... Setting up libquadmath0:amd64 (4.9.2-10) ...
Setting up libtsan0:amd64 (4.9.2-10) ... Setting up libubsan0:amd64 (4.9.2-10)
... Setting up libmpc3:amd64 (1.0.2-1) ... Setting up binutils (2.25-5+deb8u1)
... Setting up cpp-4.9 (4.9.2-10) ... Setting up cpp (4:4.9.2-2) ... Setting up
cpp-4.8 (4.8.4-1) ... Setting up libgcc-4.9-dev:amd64 (4.9.2-10) ... Setting up
gcc-4.9 (4.9.2-10) ... Setting up gcc (4:4.9.2-2) ... Setting up make (4.0-8.1)
... Setting up dkms (2.2.0.3-2) ... Setting up libfakeroot:amd64 (1.20.2-1) ...
Setting up fakeroot (1.20.2-1) ... update-alternatives: using /usr/bin
/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode Setting up
libgcc-4.8-dev:amd64 (4.8.4-1) ... Setting up gcc-4.8 (4.8.4-1) ... Setting up
libc-dev-bin (2.19-18+deb8u9) ... Setting up linux-libc-dev:amd64 (3.16.43-2)
... Setting up libc6-dev:amd64 (2.19-18+deb8u9) ... Setting up linux-compiler-
gcc-4.8-x86 (3.16.43-2) ... Setting up linux-headers-3.16.0-4-common
(3.16.43-2) ... Setting up linux-kbuild-3.16 (3.16.7-ckt20-1) ... Setting up
linux-headers-3.16.0-4-amd64 (3.16.43-2) ... Examining
/etc/kernel/header_postinst.d. run-parts: executing
/etc/kernel/header_postinst.d/dkms 3.16.0-4-amd64 Setting up linux-headers-
amd64 (3.16+63) ... Setting up manpages-dev (3.74-1) ... Processing triggers
for libc-bin (2.19-18+deb8u9) ... Copy iso file
/usr/share/virtualbox/VBoxGuestAdditions.iso into the box
/tmp/VBoxGuestAdditions.iso mount: /dev/loop0 is write-protected, mounting
read-only Installing Virtualbox Guest Additions 5.1.22 - guest version is
unknown Verifying archive integrity... All good. Uncompressing VirtualBox
5.1.22 Guest Additions for Linux........... VirtualBox Guest Additions
installer Copying additional installer modules ... Installing additional
modules ... vboxadd.sh: Starting the VirtualBox Guest Additions. ==> instance:
Checking for guest additions in VM... ==> instance: Setting hostname... ==>
instance: Configuring and enabling network interfaces... ==> instance:
Installing rsync to the VM... ==> instance: Rsyncing folder: /home/cyrille/code
/test/molecule/test/scenarios/driver/vagrant/molecule/default/.molecule/ =>
/vagrant ==> instance: Machine not provisioned because `--no-provision` is
specified.  ==> instance: Machine 'instance' has a post `vagrant up` message.
This is a message ==> instance: from the creator of the Vagrantfile, and not
from Vagrant itself: ==> instance:  ==> instance: Vanilla Debian box. See
https://atlas.hashicorp.com/debian/ for help and bug reports  {"IdentityFile":
"/home/cyrille/code/test/molecule/test/scenarios/driver/vagrant/molecule/defaul
t/.molecule/.vagrant/machines/instance/virtualbox/private_key", "changed":
true, "LogLevel": "FATAL", "HostName": "127.0.0.1", "Host": "instance",
"PasswordAuthentication": "no", "IdentitiesOnly": "yes", "UserKnownHostsFile":
"/dev/null", "User": "vagrant", "invocation": {"module_args":
{"platform_box_url": null, "provider_cpus": 2, "provider_raw_config_args":
null, "platform_box": "debian/jessie64", "state": "up", "instance_interfaces":
[{"auto_config": true, "network_name": "private_network", "type": "dhcp"}],
"instance_name": "instance", "platform_box_version": null, "provider_memory":
512, "instance_raw_config_args": ["vm.boot_timeout = 700"], "provider_options":
{}, "provider_name": "virtualbox", "force_stop": false}},
"StrictHostKeyChecking": "no", "Port": "2201"}

        "module_stdout": "Bringing machine 'instance' up with 'virtualbox' provider...\n==> instance: Cloning VM...\n\r\u001b[K==> instance: Matching MAC address for NAT networking...\n==> instance: Checking if box 'debian/jessie64' is up to date...\n==> instance: Setting the name of the VM: molecule_instance_1499928380511_86518\n==> instance: Fixed port collision for 22 => 2222. Now on port 2201.\n==> instance: Clearing any previously set network interfaces...\n==> instance: Preparing network interfaces based on configuration...\n    instance: Adapter 1: nat\n    instance: Adapter 2: hostonly\n==> instance: Forwarding ports...\n    instance: 22 (guest) => 2201 (host) (adapter 1)\n==> instance: Running 'pre-boot' VM customizations...\n==> instance: Booting VM...\n==> instance: Waiting for machine to boot. This may take a few minutes...\n    instance: SSH address: 127.0.0.1:2201\n    instance: SSH username: vagrant\n    instance: SSH auth method: private key\n    instance: \n    instance: Vagrant insecure key detected. Vagrant will automatically replace\n    instance: this with a newly generated keypair for better security.\n    instance: \n    instance: Inserting generated public key within guest...\n    instance: Removing insecure key from the guest if it's present...\n    instance: Key inserted! Disconnecting and reconnecting using new SSH key...\n==> instance: Machine booted and ready!\n[instance] No installation found.\nReading package lists...\nBuilding dependency tree...\nReading state information...\nThe following extra packages will be installed:\n  binutils cpp cpp-4.8 cpp-4.9 fakeroot gcc gcc-4.8 gcc-4.9 libasan0 libasan1\n  libatomic1 libc-dev-bin libc6-dev libcilkrts5 libcloog-isl4 libfakeroot\n  libgcc-4.8-dev libgcc-4.9-dev libgomp1 libisl10 libitm1 liblsan0 libmpc3\n  libmpfr4 libquadmath0 libtsan0 libubsan0 linux-compiler-gcc-4.8-x86\n  linux-headers-3.16.0-4-common linux-headers-amd64 linux-kbuild-3.16\n  linux-libc-dev make manpages-dev\nSuggested packages:\n  binutils-doc cpp-doc gcc-4.8-locales gcc-4.9-locales gcc-multilib autoconf\n  automake libtool flex bison gdb gcc-doc gcc-4.8-multilib gcc-4.8-doc\n  libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan0-dbg\n  libtsan0-dbg libquadmath0-dbg gcc-4.9-multilib gcc-4.9-doc libasan1-dbg\n  liblsan0-dbg libubsan0-dbg libcilkrts5-dbg glibc-doc make-doc\nRecommended packages:\n  linux-image\nThe following NEW packages will be installed:\n  binutils cpp cpp-4.8 cpp-4.9 dkms fakeroot gcc gcc-4.8 gcc-4.9 libasan0\n  libasan1 libatomic1 libc-dev-bin libc6-dev libcilkrts5 libcloog-isl4\n  libfakeroot libgcc-4.8-dev libgcc-4.9-dev libgomp1 libisl10 libitm1 liblsan0\n  libmpc3 libmpfr4 libquadmath0 libtsan0 libubsan0 linux-compiler-gcc-4.8-x86\n  linux-headers-3.16.0-4-amd64 linux-headers-3.16.0-4-common\n  linux-headers-amd64 linux-kbuild-3.16 linux-libc-dev make manpages-dev\n0 upgraded, 36 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 40.4 MB of archives.\nAfter this operation, 153 MB of additional disk space will be used.\nGet:1 http://deb.debian.org/debian/ jessie/main libasan0 amd64 4.8.4-1 [63.3 kB]\nGet:2 http://deb.debian.org/debian/ jessie/main libasan1 amd64 4.9.2-10 [195 kB]\nGet:3 http://deb.debian.org/debian/ jessie/main libatomic1 amd64 4.9.2-10 [8,992 B]\nGet:4 http://deb.debian.org/debian/ jessie/main libcilkrts5 amd64 4.9.2-10 [40.1 kB]\nGet:5 http://deb.debian.org/debian/ jessie/main libisl10 amd64 0.12.2-2 [440 kB]\nGet:6 http://deb.debian.org/debian/ jessie/main libcloog-isl4 amd64 0.18.2-1+b2 [61.8 kB]\nGet:7 http://deb.debian.org/debian/ jessie/main libgomp1 amd64 4.9.2-10 [37.8 kB]\nGet:8 http://deb.debian.org/debian/ jessie/main libitm1 amd64 4.9.2-10 [29.2 kB]\nGet:9 http://deb.debian.org/debian/ jessie/main liblsan0 amd64 4.9.2-10 [92.8 kB]\nGet:10 http://deb.debian.org/debian/ jessie/main libmpfr4 amd64 3.1.2-2 [527 kB]\nGet:11 http://deb.debian.org/debian/ jessie/main libquadmath0 amd64 4.9.2-10 [129 kB]\nGet:12 http://deb.debian.org/debian/ jessie/main libtsan0 amd64 4.9.2-10 [212 kB]\nGet:13 http://deb.debian.org/debian/ jessie/main libubsan0 amd64 4.9.2-10 [82.4 kB]\nGet:14 http://deb.debian.org/debian/ jessie/main libmpc3 amd64 1.0.2-1 [39.3 kB]\nGet:15 http://deb.debian.org/debian/ jessie/main binutils amd64 2.25-5+deb8u1 [3,496 kB]\nGet:16 http://deb.debian.org/debian/ jessie/main cpp-4.9 amd64 4.9.2-10 [5,169 kB]\nGet:17 http://deb.debian.org/debian/ jessie/main cpp amd64 4:4.9.2-2 [17.3 kB]\nGet:18 http://deb.debian.org/debian/ jessie/main cpp-4.8 amd64 4.8.4-1 [4,577 kB]\nGet:19 http://deb.debian.org/debian/ jessie/main libgcc-4.9-dev amd64 4.9.2-10 [2,066 kB]\nGet:20 http://deb.debian.org/debian/ jessie/main gcc-4.9 amd64 4.9.2-10 [5,352 kB]\nGet:21 http://deb.debian.org/debian/ jessie/main gcc amd64 4:4.9.2-2 [5,136 B]\nGet:22 http://deb.debian.org/debian/ jessie/main make amd64 4.0-8.1 [349 kB]\nGet:23 http://deb.debian.org/debian/ jessie/main dkms all 2.2.0.3-2 [70.9 kB]\nGet:24 http://deb.debian.org/debian/ jessie/main libfakeroot amd64 1.20.2-1 [44.7 kB]\nGet:25 http://deb.debian.org/debian/ jessie/main fakeroot amd64 1.20.2-1 [84.7 kB]\nGet:26 http://deb.debian.org/debian/ jessie/main libgcc-4.8-dev amd64 4.8.4-1 [1,689 kB]\nGet:27 http://deb.debian.org/debian/ jessie/main gcc-4.8 amd64 4.8.4-1 [4,787 kB]\nGet:28 http://deb.debian.org/debian/ jessie/main libc-dev-bin amd64 2.19-18+deb8u9 [238 kB]\nGet:29 http://deb.debian.org/debian/ jessie/main linux-libc-dev amd64 3.16.43-2 [1,059 kB]\nGet:30 http://deb.debian.org/debian/ jessie/main libc6-dev amd64 2.19-18+deb8u9 [2,003 kB]\nGet:31 http://deb.debian.org/debian/ jessie/main linux-compiler-gcc-4.8-x86 amd64 3.16.43-2 [359 kB]\nGet:32 http://deb.debian.org/debian/ jessie/main linux-headers-3.16.0-4-common amd64 3.16.43-2 [4,555 kB]\nGet:33 http://deb.debian.org/debian/ jessie/main linux-kbuild-3.16 amd64 3.16.7-ckt20-1 [174 kB]\nGet:34 http://deb.debian.org/debian/ jessie/main linux-headers-3.16.0-4-amd64 amd64 3.16.43-2 [451 kB]\nGet:35 http://deb.debian.org/debian/ jessie/main linux-headers-amd64 amd64 3.16+63 [5,050 B]\nGet:36 http://deb.debian.org/debian/ jessie/main manpages-dev all 3.74-1 [1,865 kB]\ndpkg-preconfigure: unable to re-open stdin: No such file or directory\nFetched 40.4 MB in 6s (6,063 kB/s)\nSelecting previously unselected package libasan0:amd64.\r\n(Reading database ... \r(Reading database ... 5%\r(Reading database ... 10%\r(Reading database ... 15%\r(Reading database ... 20%\r(Reading database ... 25%\r(Reading database ... 30%\r(Reading database ... 35%\r(Reading database ... 40%\r(Reading database ... 45%\r(Reading database ... 50%\r(Reading database ... 55%\r(Reading database ... 60%\r(Reading database ... 65%\r(Reading database ... 70%\r(Reading database ... 75%\r(Reading database ... 80%\r(Reading database ... 85%\r(Reading database ... 90%\r(Reading database ... 95%\r(Reading database ... 100%\r(Reading database ... 28311 files and directories currently installed.)\r\nPreparing to unpack .../libasan0_4.8.4-1_amd64.deb ...\r\nUnpacking libasan0:amd64 (4.8.4-1) ...\r\nSelecting previously unselected package libasan1:amd64.\r\nPreparing to unpack .../libasan1_4.9.2-10_amd64.deb ...\r\nUnpacking libasan1:amd64 (4.9.2-10) ...\r\nSelecting previously unselected package libatomic1:amd64.\r\nPreparing to unpack .../libatomic1_4.9.2-10_amd64.deb ...\r\nUnpacking libatomic1:amd64 (4.9.2-10) ...\r\nSelecting previously unselected package libcilkrts5:amd64.\r\nPreparing to unpack .../libcilkrts5_4.9.2-10_amd64.deb ...\r\nUnpacking libcilkrts5:amd64 (4.9.2-10) ...\r\nSelecting previously unselected package libisl10:amd64.\r\nPreparing to unpack .../libisl10_0.12.2-2_amd64.deb ...\r\nUnpacking libisl10:amd64 (0.12.2-2) ...\r\nSelecting previously unselected package libcloog-isl4:amd64.\r\nPreparing to unpack .../libcloog-isl4_0.18.2-1+b2_amd64.deb ...\r\nUnpacking libcloog-isl4:amd64 (0.18.2-1+b2) ...\r\nSelecting previously unselected package libgomp1:amd64.\r\nPreparing to unpack .../libgomp1_4.9.2-10_amd64.deb ...\r\nUnpacking libgomp1:amd64 (4.9.2-10) ...\r\nSelecting previously unselected package libitm1:amd64.\r\nPreparing to unpack .../libitm1_4.9.2-10_amd64.deb ...\r\nUnpacking libitm1:amd64 (4.9.2-10) ...\r\nSelecting previously unselected package liblsan0:amd64.\r\nPreparing to unpack .../liblsan0_4.9.2-10_amd64.deb ...\r\nUnpacking liblsan0:amd64 (4.9.2-10) ...\r\nSelecting previously unselected package libmpfr4:amd64.\r\nPreparing to unpack .../libmpfr4_3.1.2-2_amd64.deb ...\r\nUnpacking libmpfr4:amd64 (3.1.2-2) ...\r\nSelecting previously unselected package libquadmath0:amd64.\r\nPreparing to unpack .../libquadmath0_4.9.2-10_amd64.deb ...\r\nUnpacking libquadmath0:amd64 (4.9.2-10) ...\r\nSelecting previously unselected package libtsan0:amd64.\r\nPreparing to unpack .../libtsan0_4.9.2-10_amd64.deb ...\r\nUnpacking libtsan0:amd64 (4.9.2-10) ...\r\nSelecting previously unselected package libubsan0:amd64.\r\nPreparing to unpack .../libubsan0_4.9.2-10_amd64.deb ...\r\nUnpacking libubsan0:amd64 (4.9.2-10) ...\r\nSelecting previously unselected package libmpc3:amd64.\r\nPreparing to unpack .../libmpc3_1.0.2-1_amd64.deb ...\r\nUnpacking libmpc3:amd64 (1.0.2-1) ...\r\nSelecting previously unselected package binutils.\r\nPreparing to unpack .../binutils_2.25-5+deb8u1_amd64.deb ...\r\nUnpacking binutils (2.25-5+deb8u1) ...\r\nSelecting previously unselected package cpp-4.9.\r\nPreparing to unpack .../cpp-4.9_4.9.2-10_amd64.deb ...\r\nUnpacking cpp-4.9 (4.9.2-10) ...\r\nSelecting previously unselected package cpp.\r\nPreparing to unpack .../cpp_4%3a4.9.2-2_amd64.deb ...\r\nUnpacking cpp (4:4.9.2-2) ...\r\nSelecting previously unselected package cpp-4.8.\r\nPreparing to unpack .../cpp-4.8_4.8.4-1_amd64.deb ...\r\nUnpacking cpp-4.8 (4.8.4-1) ...\r\nSelecting previously unselected package libgcc-4.9-dev:amd64.\r\nPreparing to unpack .../libgcc-4.9-dev_4.9.2-10_amd64.deb ...\r\nUnpacking libgcc-4.9-dev:amd64 (4.9.2-10) ...\r\nSelecting previously unselected package gcc-4.9.\r\nPreparing to unpack .../gcc-4.9_4.9.2-10_amd64.deb ...\r\nUnpacking gcc-4.9 (4.9.2-10) ...\r\nSelecting previously unselected package gcc.\r\nPreparing to unpack .../gcc_4%3a4.9.2-2_amd64.deb ...\r\nUnpacking gcc (4:4.9.2-2) ...\r\nSelecting previously unselected package make.\r\nPreparing to unpack .../make_4.0-8.1_amd64.deb ...\r\nUnpacking make (4.0-8.1) ...\r\nSelecting previously unselected package dkms.\r\nPreparing to unpack .../dkms_2.2.0.3-2_all.deb ...\r\nUnpacking dkms (2.2.0.3-2) ...\r\nSelecting previously unselected package libfakeroot:amd64.\r\nPreparing to unpack .../libfakeroot_1.20.2-1_amd64.deb ...\r\nUnpacking libfakeroot:amd64 (1.20.2-1) ...\r\nSelecting previously unselected package fakeroot.\r\nPreparing to unpack .../fakeroot_1.20.2-1_amd64.deb ...\r\nUnpacking fakeroot (1.20.2-1) ...\r\nSelecting previously unselected package libgcc-4.8-dev:amd64.\r\nPreparing to unpack .../libgcc-4.8-dev_4.8.4-1_amd64.deb ...\r\nUnpacking libgcc-4.8-dev:amd64 (4.8.4-1) ...\r\nSelecting previously unselected package gcc-4.8.\r\nPreparing to unpack .../gcc-4.8_4.8.4-1_amd64.deb ...\r\nUnpacking gcc-4.8 (4.8.4-1) ...\r\nSelecting previously unselected package libc-dev-bin.\r\nPreparing to unpack .../libc-dev-bin_2.19-18+deb8u9_amd64.deb ...\r\nUnpacking libc-dev-bin (2.19-18+deb8u9) ...\r\nSelecting previously unselected package linux-libc-dev:amd64.\r\nPreparing to unpack .../linux-libc-dev_3.16.43-2_amd64.deb ...\r\nUnpacking linux-libc-dev:amd64 (3.16.43-2) ...\r\nSelecting previously unselected package libc6-dev:amd64.\r\nPreparing to unpack .../libc6-dev_2.19-18+deb8u9_amd64.deb ...\r\nUnpacking libc6-dev:amd64 (2.19-18+deb8u9) ...\r\nSelecting previously unselected package linux-compiler-gcc-4.8-x86.\r\nPreparing to unpack .../linux-compiler-gcc-4.8-x86_3.16.43-2_amd64.deb ...\r\nUnpacking linux-compiler-gcc-4.8-x86 (3.16.43-2) ...\r\nSelecting previously unselected package linux-headers-3.16.0-4-common.\r\nPreparing to unpack .../linux-headers-3.16.0-4-common_3.16.43-2_amd64.deb ...\r\nUnpacking linux-headers-3.16.0-4-common (3.16.43-2) ...\r\nSelecting previously unselected package linux-kbuild-3.16.\r\nPreparing to unpack .../linux-kbuild-3.16_3.16.7-ckt20-1_amd64.deb ...\r\nUnpacking linux-kbuild-3.16 (3.16.7-ckt20-1) ...\r\nSelecting previously unselected package linux-headers-3.16.0-4-amd64.\r\nPreparing to unpack .../linux-headers-3.16.0-4-amd64_3.16.43-2_amd64.deb ...\r\nUnpacking linux-headers-3.16.0-4-amd64 (3.16.43-2) ...\r\nSelecting previously unselected package linux-headers-amd64.\r\nPreparing to unpack .../linux-headers-amd64_3.16+63_amd64.deb ...\r\nUnpacking linux-headers-amd64 (3.16+63) ...\r\nSelecting previously unselected package manpages-dev.\r\nPreparing to unpack .../manpages-dev_3.74-1_all.deb ...\r\nUnpacking manpages-dev (3.74-1) ...\r\nProcessing triggers for man-db (2.7.0.2-5) ...\r\nSetting up libasan0:amd64 (4.8.4-1) ...\r\nSetting up libasan1:amd64 (4.9.2-10) ...\r\nSetting up libatomic1:amd64 (4.9.2-10) ...\r\nSetting up libcilkrts5:amd64 (4.9.2-10) ...\r\nSetting up libisl10:amd64 (0.12.2-2) ...\r\nSetting up libcloog-isl4:amd64 (0.18.2-1+b2) ...\r\nSetting up libgomp1:amd64 (4.9.2-10) ...\r\nSetting up libitm1:amd64 (4.9.2-10) ...\r\nSetting up liblsan0:amd64 (4.9.2-10) ...\r\nSetting up libmpfr4:amd64 (3.1.2-2) ...\r\nSetting up libquadmath0:amd64 (4.9.2-10) ...\r\nSetting up libtsan0:amd64 (4.9.2-10) ...\r\nSetting up libubsan0:amd64 (4.9.2-10) ...\r\nSetting up libmpc3:amd64 (1.0.2-1) ...\r\nSetting up binutils (2.25-5+deb8u1) ...\r\nSetting up cpp-4.9 (4.9.2-10) ...\r\nSetting up cpp (4:4.9.2-2) ...\r\nSetting up cpp-4.8 (4.8.4-1) ...\r\nSetting up libgcc-4.9-dev:amd64 (4.9.2-10) ...\r\nSetting up gcc-4.9 (4.9.2-10) ...\r\nSetting up gcc (4:4.9.2-2) ...\r\nSetting up make (4.0-8.1) ...\r\nSetting up dkms (2.2.0.3-2) ...\r\nSetting up libfakeroot:amd64 (1.20.2-1) ...\r\nSetting up fakeroot (1.20.2-1) ...\r\nupdate-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode\r\nSetting up libgcc-4.8-dev:amd64 (4.8.4-1) ...\r\nSetting up gcc-4.8 (4.8.4-1) ...\r\nSetting up libc-dev-bin (2.19-18+deb8u9) ...\r\nSetting up linux-libc-dev:amd64 (3.16.43-2) ...\r\nSetting up libc6-dev:amd64 (2.19-18+deb8u9) ...\r\nSetting up linux-compiler-gcc-4.8-x86 (3.16.43-2) ...\r\nSetting up linux-headers-3.16.0-4-common (3.16.43-2) ...\r\nSetting up linux-kbuild-3.16 (3.16.7-ckt20-1) ...\r\nSetting up linux-headers-3.16.0-4-amd64 (3.16.43-2) ...\r\nExamining /etc/kernel/header_postinst.d.\r\nrun-parts: executing /etc/kernel/header_postinst.d/dkms 3.16.0-4-amd64\r\nSetting up linux-headers-amd64 (3.16+63) ...\r\nSetting up manpages-dev (3.74-1) ...\r\nProcessing triggers for libc-bin (2.19-18+deb8u9) ...\r\nCopy iso file /usr/share/virtualbox/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso\nmount: /dev/loop0 is write-protected, mounting read-only\nInstalling Virtualbox Guest Additions 5.1.22 - guest version is unknown\nVerifying archive integrity... All good.\nUncompressing VirtualBox 5.1.22 Guest Additions for Linux...........\nVirtualBox Guest Additions installer\nCopying additional installer modules ...\nInstalling additional modules ...\nvboxadd.sh: Starting the VirtualBox Guest Additions.\n==> instance: Checking for guest additions in VM...\n==> instance: Setting hostname...\n==> instance: Configuring and enabling network interfaces...\n==> instance: Installing rsync to the VM...\n==> instance: Rsyncing folder: /home/cyrille/code/test/molecule/test/scenarios/driver/vagrant/molecule/default/.molecule/ => /vagrant\n==> instance: Machine not provisioned because `--no-provision` is specified.\n\n==> instance: Machine 'instance' has a post `vagrant up` message. This is a message\n==> instance: from the creator of the Vagrantfile, and not from Vagrant itself:\n==> instance: \n==> instance: Vanilla Debian box. See https://atlas.hashicorp.com/debian/ for help and bug reports\n\n{\"IdentityFile\": \"/home/cyrille/code/test/molecule/test/scenarios/driver/vagrant/molecule/default/.molecule/.vagrant/machines/instance/virtualbox/private_key\", \"changed\": true, \"LogLevel\": \"FATAL\", \"HostName\": \"127.0.0.1\", \"Host\": \"instance\", \"PasswordAuthentication\": \"no\", \"IdentitiesOnly\": \"yes\", \"UserKnownHostsFile\": \"/dev/null\", \"User\": \"vagrant\", \"invocation\": {\"module_args\": {\"platform_box_url\": null, \"provider_cpus\": 2, \"provider_raw_config_args\": null, \"platform_box\": \"debian/jessie64\", \"state\": \"up\", \"instance_interfaces\": [{\"auto_config\": true, \"network_name\": \"private_network\", \"type\": \"dhcp\"}], \"instance_name\": \"instance\", \"platform_box_version\": null, \"provider_memory\": 512, \"instance_raw_config_args\": [\"vm.boot_timeout = 700\"], \"provider_options\": {}, \"provider_name\": \"virtualbox\", \"force_stop\": false}}, \"StrictHostKeyChecking\": \"no\", \"Port\": \"2201\"}\n", 
        "msg": "MODULE FAILURE", 
        "rc": 0
    }
    
    PLAY RECAP *********************************************************************
    localhost                  : ok=0    changed=0    unreachable=0    failed=1   
    
    
ERROR: 
```

The problems happens when the output of `vagrant up` (invoked by `molecule_vagrant.py`) contains a line that starts with a JSON delimiter : `{` or `]`

In my scenario, output of `vagrant up` was matching this case at line 53:
```
....
[instance] No installation found.
....
```

Ansible implementation expects that all Ansible modules output any lines followed by a JSON document.
The  Ansible implementation is 

```
    def _parse_returned_data(self, res):
        try:
            filtered_output, warnings = _filter_non_json_lines(res.get('stdout', u''))
            for w in warnings:
                display.warning(w)

            data = json.loads(filtered_output)
```
And `_filter_non_json_lines` searches for the first line starting with one of the 2 characters: `[` and `{` 

In my case, Ansible detects the start of the JSON document when it parses `[instance] No installation found` line that was output by `vagrant up`.


### Solution

In `molecule/provisioner/ansible/plugins/libraries/molecule_vagrant.py`:
Make sure that the output of the vagrant.up() is not detected as the start of a JSON document.

1. Stream the output of vagrant.up()
2. Filter by either
  - Ignore the line
  - Add a prefix to the line 


Resolving patch:
diff --git a/molecule/provisioner/ansible/plugins/libraries/molecule_vagrant.py b/molecule/provisioner/ansible/plugins/libraries/molecule_vagrant.py
--- a/molecule/provisioner/ansible/plugins/libraries/molecule_vagrant.py
+++ b/molecule/provisioner/ansible/plugins/libraries/molecule_vagrant.py
@@ -294,7 +294,9 @@ def up(self, no_provision=True):
         cd = self._created()
         if not cd:
             changed = True
-            self._vagrant.up(no_provision)
+            for line in self._vagrant.up(no_provision, stream_output=True):
+              # Add prefix to ensure that output of 'vagrant up' doesn't start with one of the JSON start characters { or ]
+              print ('<vagrant_output> {}'.format(line))
 
         self._module.exit_json(changed=changed, **self._conf())
 


Test patch: