Virtual Box Installation on Windows Server 2012

23 views
Skip to first unread message

SUMIT SAHAY

unread,
Feb 22, 2018, 5:29:44 AM2/22/18
to Ansible Project
Hello Everyone,

I want to install virtual box on window server 2012, I wrote one playbook here below for reference,

---
- name: install vb
  hosts: winserver
  strategy: free
  gather_facts: false
  tasks:
    - win_package:
        path: 'C:\Path_of_file\VirtualBox-5.2.0-118431-Win.exe'
#        product_id: oracle
        product_id: '{product_id}'
        state: present
        #wait: true
...

Is there anything I am missing in playbook because while running this playbook I am getting the below error,

"changed": false,
    "exit_code": 1,
    "failed": true,
    "msg": "unexpected rc from install C:\\Path_of_file\\VirtualBox-5.2.0-118431-Win.exe : see exit_code, stdout and stderr for more details",
    "rc": 1,
    "reboot_required": false,
    "restart_required": false,
    "stderr": "",
    "stderr_lines": [],
    "stdout": "",
    "stdout_lines": []


Looking forward for reply.

Thanks & Regards
Sumit Sahay
sumitsa...@gmail.com




J Hawkesworth

unread,
Feb 25, 2018, 3:34:54 AM2/25/18
to Ansible Project
Hmm, I think installing Virtualbox might be a bit tricky as, if I recall, it installs it's own network drivers and has to restart networking during the installation. Restarting networking is pretty much guaranteed to stop winrm I think.

That said you are getting an error rather than a communication failure so perhaps something else is wrong. Most likely thing is that the installer is expecting some kind of input from the user.

I am not exactly sure what is going on but there
are a few things that you can try.

You could try using win_chocolatey to install virtualbox. It is also worth trying using become: runas and having the installation run as the local Administrator user.

I suspect you may still hit the problem with the networking restart. You might be able to get round that by either telling the installer not to restart networking during the installation, or if that isn't possible, by setting up a scheduled task to do the installation.

Hope this helps and you are able to install.

Jon

Jordan Borean

unread,
Feb 25, 2018, 5:23:18 AM2/25/18
to Ansible Project
One other thing to look at is the silent arguments required to install the application. Most of the time if you open an executable directly without any arguments it opens up the GUI and in this case there is no GUI so it fails.

VirtualBox has a whole guide on how to do this https://www.virtualbox.org/manual/ch02.html#installation_windows, it seems like you need to extract the MSI installer from the exe and then install that but look at the guide for more details.

As jhawkesworth is saying, chocolatey is definitely an easier way to do this as someone else would have done the hard work to figure how to install it silently https://chocolatey.org/packages/virtualbox.

Thanks

Jordan

Reply all
Reply to author
Forward
0 new messages