ansible 2.7.1
molecule, version 2.19.0
python-vagrant==0.5.15
Molecule installation method (one of):
Ansible installation method (one of):
molecule should write all the logs to $TMPDIR. If molecule is installed in a folder where you don't have write permissons it crashes when booting a vagrant instance.
$> echo $TMPDIR
/tmp/escobar
$> molecule init role --driver-name vagrant --role-name testing-molecule-vagrant
$> rm testing-molecule-vagrant/tasks/main.yml
$> cat <<EOF >> testing-molecule-vagrant/tasks/main.yml
---
# tasks file for testing-molecule-vagrant
- name: just a test
command: uname -r
changed_when: false
EOF
$> cd testing-molecule-vagrant
$> molecule --debug test
During TASK [Create molecule instance(s)] you get error: "msg": "ERROR: See log file '/tmp/escobar/molecule/testing-molecule-vagrant/default/vagrant-instance.err'"
and in the log file:
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["startvm", "384da504-e582-41a5-8f4f-08f478b62768", "--type", "headless"]
Stderr: VBoxManage: error: RawFile#0 failed to create the raw output file /data/virtualenvs/ansible-2.7.1-molecule-2.19.0/lib/python2.7/site-packages/molecule/provisioner/ansible/playbooks/vagrant/ubuntu-xenial-16.04-cloudimg-console.log (VERR_ACCESS_DENIED)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole
### 2018-11-05 22:06:45 ###
in this machine ansible and molecule are installed in a virtualenv located in /data/virtualenvs/ansible-2.7.1-molecule-2.19.0/ that is not owned by my user
I found I can workaround the problem if I change default/molecule.yml from the default value:
platforms:
- name: instance
box: ubuntu/xenial64
to
platforms:
- name: instance
box: bento/ubuntu-16.04
I thought that the log file is a vagrant option and it's independent of the used box but it seems it's not like that?
I had the exact same problem - using another box worked also for me.
BUT I wanted to use my "standard" ubuntu/bionic64 or ubuntu/xenial64, so I dived a bit deeper. And there麓s a reported issue with this fix here: https://github.com/joelhandwell/ubuntu_vagrant_boxes/issues/1#issuecomment-292370353, where you need to add v.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ] to your Vagrantfile. Since we麓re using Molecule which generates the Vagrantfile for us, we need to use platform.provider_raw_config_args to do the trick:
platforms:
- name: ubuntu-docker
box: ubuntu/bionic64
memory: 512
cpus: 1
provider_raw_config_args:
- "customize [ 'modifyvm', :id, '--uartmode1', 'disconnected' ]"
Here麓s my example repo for checking full source: https://github.com/jonashackt/molecule-ansible-docker-vagrant
I consider this fix something that could be useful to have in the default Molecule Vagrant module because it isn麓t quite beautiful to have to always set this up to get things running - especially for Molecule beginners.
Most helpful comment
I had the exact same problem - using another box worked also for me.
BUT I wanted to use my "standard"
ubuntu/bionic64orubuntu/xenial64, so I dived a bit deeper. And there麓s a reported issue with this fix here: https://github.com/joelhandwell/ubuntu_vagrant_boxes/issues/1#issuecomment-292370353, where you need to addv.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]to yourVagrantfile. Since we麓re using Molecule which generates theVagrantfilefor us, we need to useplatform.provider_raw_config_argsto do the trick:Here麓s my example repo for checking full source: https://github.com/jonashackt/molecule-ansible-docker-vagrant
I consider this fix something that could be useful to have in the default Molecule Vagrant module because it isn麓t quite beautiful to have to always set this up to get things running - especially for Molecule beginners.