I intend to launch a number of of vms on multiple host machines. So I have a playbook that installs vagrant and virtualbox on the host machine. Following the installations, the playbook then copies specific Vagrantfile from the ansible controller to the remote host where vms are to be lauched via ‘vagrant up’.
NB:
I am able to run the ‘vagrant up’ on the target machine but an error is thrown when I use the ansible playbook
Before running the ansible, I already have set up a sudoer user called devops.
Target host machines are ubuntu 22 desktop
ansible version 2.10.8
vagrant version 2.3.1
virtualbox version 6.1
I'm surprised that this doesn't need "become: true"?
- name: move to vagrant-deploy and launch vms for this host
shell:
cmd: vagrant up
chdir: /home/devops/vagrant-deploy/
become: yes
And I'm surprised that running vagrant needs 'become: yes'.
AFAIK vagrant does not need this.
"start": "2022-10-15 12:08:49.181709",
"stderr": "There was an error while executing `VBoxManage`, a CLI used by Vagrant\nfor controlling VirtualBox. The command and stderr is shown below.\n\nCommand: [\"showvminfo\", \"9420c5e1-629e-4148-8ce1-92658357a477\"]\n\nStderr: /usr/lib/virtualbox/VBoxManage: /tmp/.mount_vagranMxQRIa/usr/lib/libcurl.so.4: no version information available (required by /usr/lib/virtualbox/VBoxRT.so)\nVBoxManage: error: Failed to create the VirtualBox object!\nVBoxManage: error: Code NS_ERROR_ABORT (0x80004004) - Operation aborted (extended info not available)\nVBoxManage: error: Most likely, the VirtualBox COM server is not running or failed to start.",
This sounds like your Ubuntu host is missing libcurl.
Try adding that (libcurl4 to be precise) to the list of packages that
you install in the "install prerequisites" task.