NB: The ansible controller is a multipass running ubuntu 22.04

On Sunday, October 16, 2022 at 10:57:24 PM UTC+3 Oremo Ojwang wrote:

>
>
> 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
>
> Below is the playbook content:
>
> ---
> - hosts: vagranthosts
>   remote_user: devops
>   become: yes
>
>   roles: 
>   - robertdebock.virtualbox
>   - darkwizard242.vagrant
>
>   tasks:
>   - name: Show host's ip
>     debug:
>       msg: "{{ ansible_ssh_host }}"
>
>
>   - name: Remove vagrant previous file
>     file:
>       path: /home/devops/vagrant-deploy/Vagrantfile
>       state: absent
>
>   
>   - name: install prerequisites
>     apt:
>       name: libfuse2
>       state: present
>
>   - name: move to vagrant-deploy and launch vms for this host
>     shell:
>       cmd: vagrant up
>       chdir: /home/devops/vagrant-deploy/
>     become: yes
>
> Blow is the line use to run the playbook:
>
> ansible-playbook -i hosts.ini install-vagrant.yaml -kK -vvv
>
> Below the specific Vagrant file that is failing:
>
> # -*- mode: ruby -*-
> # vi: set ft=ruby :
>
> VAGRANTFILE_API_VERSION = "2"
>
> Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
>   # General Vagrant VM configuration.
>   config.vm.box = "bento/ubuntu-22.04"
>   config.ssh.insert_key = false
>   config.vm.synced_folder ".", "/vagrant", disabled: true
>   config.vm.provider :virtualbox do |v|
>     v.memory = 1024
>     v.linked_clone = true
>   end
>
>   # vagrant server 01.
>   config.vm.define "app" do |app|
>     app.vm.hostname = "orc-app1.test"
>     app.vm.network :private_network, ip: "192.168.60.201"
>   end
>
>   # vagrant server 02
>   config.vm.define "app" do |app|
>     app.vm.hostname = "orc-app2.test"
>     app.vm.network :private_network, ip: "192.168.60.202"
>   end
>
>   
> end
>
> Below is error:
>
> fatal: [192.168.1.138]: FAILED! => {
>     "changed": true,
>     "cmd": "vagrant up",
>     "delta": "0:00:17.237544",
>     "end": "2022-10-15 12:09:06.419253",
>     "invocation": {
>         "module_args": {
>             "_raw_params": "vagrant up",
>             "_uses_shell": true,
>             "argv": null,
>             "chdir": "/home/devops/vagrant-deploy/",
>             "creates": null,
>             "executable": null,
>             "removes": null,
>             "stdin": null,
>             "stdin_add_newline": true,
>             "strip_empty_ends": true,
>             "warn": true
>         }
>     },
>     "msg": "non-zero return code",
>     "rc": 1,
>     "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.",
>     "stderr_lines": [
>         "There was an error while executing `VBoxManage`, a CLI used by 
> Vagrant",
>         "for controlling VirtualBox. The command and stderr is shown 
> below.",
>         "",
>         "Command: [\"showvminfo\", 
> \"9420c5e1-629e-4148-8ce1-92658357a477\"]",
>         "",
>         "Stderr: /usr/lib/virtualbox/VBoxManage: 
> /tmp/.mount_vagranMxQRIa/usr/lib/libcurl.so.4: no version information 
> available (required by /usr/lib/virtualbox/VBoxRT.so)",
>         "VBoxManage: error: Failed to create the VirtualBox object!",
>         "VBoxManage: error: Code NS_ERROR_ABORT (0x80004004) - Operation 
> aborted (extended info not available)",
>         "VBoxManage: error: Most likely, the VirtualBox COM server is not 
> running or failed to start."
>     ],
>     "stdout": "",
>     "stdout_lines": []
> }
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b963c835-20c6-4aeb-9201-3e4ec7a62034n%40googlegroups.com.

Reply via email to