'VirtualBox silent install via Ansible fails?

$ ansible --version
ansible 2.10.8

Per Oracle VM VirtualBox 6.1 Silent Install (How-To Guide), I should be able to install VirtualBox silently like this

C:\temp> VirtualBox-6.1.28-147628-Win.exe --silent --ignore-reboot

and if I run the above command in a Windows command prompt, it succeeds and installs VirtualBox.

Now I do this in Ansible

- name: "Install {{ artifact_filename }}"
  win_package:
    path: "C:\\temp\\VirtualBox-6.1.28-147628-Win.exe"
    arguments: "--silent --ignore-reboot"
    state: present

and I get this when I run the playbook with the task.

fatal: [10.227.x.x]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "arguments": "--silent --ignore-reboot",
            "chdir": null,
            "client_cert": null,
            "client_cert_password": null,
            "creates_path": null,
            "creates_service": null,
            "creates_version": null,
            "expected_return_code": [
                0,
                3010
            ],
            "follow_redirects": "safe",
            "force_basic_auth": false,
            "headers": null,
            "http_agent": "ansible-httpget",
            "log_path": null,
            "maximum_redirection": 50,
            "password": null,
            "path": "C:\\temp\\VirtualBox-6.1.28-147628-Win.exe",
            "product_id": null,
            "provider": "auto",
            "proxy_password": null,
            "proxy_url": null,
            "proxy_use_default_credential": false,
            "proxy_username": null,
            "state": "present",
            "url_method": null,
            "url_password": null,
            "url_timeout": 30,
            "url_username": null,
            "use_default_credential": false,
            "use_proxy": true,
            "username": null,
            "validate_certs": true,
            "wait_for_children": false
        }
    },
    "msg": "unexpected rc from 'C:\\temp\\VirtualBox-6.1.28-147628-Win.exe --silent --ignore-reboot': see rc, stdout, and stderr for more details",
    "rc": 1,
    "reboot_required": false,
    "stderr": "",
    "stderr_lines": [],
    "stdout": "",
    "stdout_lines": []
}

What am I missing? TIA.



Solution 1:[1]

I RTFM'd the win_package documentation. It says regarding the arguments option

arguments     This is only used for the msi, msp, and registry providers.

So I do this instead

- name: "Install VirtualBox"
  win_command: "C:\\temp\\VirtualBox-6.1.28-147628-Win.exe --silent --ignore-reboot"

If anyone has a better answer I'm all eyes.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Chris F