Win_package hangs

Hi - I’m trying to use the Ansible win_package module to install “Visual C++ Redistributable Packages for Visual Studio 2013” on a Windows Server 2022 system. The win_package execution does not produce an error, but it hangs.

Here is my task code:

- name: "Install Visual C++ Redistributable Packages for Visual Studio 2013"
  ansible.windows.win_package:
    path: c:\temp\vcredist_x64.exe
  become: true
  become_method: runas
  become_user: "administrator"

After seeing the hang behavior initially, I read in Using Ansible and Windows — Ansible Community Documentation the suggestion to use ‘become’ for one issue, so I thought I’d try it for my issue, too. There was no change in behavior

I let it run for over an hour but did not see any output to ansible-playbook (run with -vvv) beyond:

TASK [install-exchange : Install Visual C++ Redistributable Packages for Visual Studio 2013] ******************************************************************
task path: /root/ecdm-ansible/ansible/roles/install-exchange/tasks/main.yml:294
Using module file /root/.ansible/collections/ansible_collections/ansible/windows/plugins/modules/win_package.ps1
Pipelining is enabled.
<myhost.com> ESTABLISH WINRM CONNECTION FOR USER: lab\Administrator on PORT 5985 TO myhost.com
EXEC (via pipeline wrapper)

Other Ansible modules run earlier in the playbook completed successfully, so I know that the basic authentication and execution machinery is functional.

I’m using:

ansible-galaxy collection list ansible.windows

/root/.ansible/collections/ansible_collections

Collection Version


ansible.windows 2.4.0

/usr/lib/python3.10/site-packages/ansible_collections

Collection Version


ansible.windows 1.14.0
b57a80c06ac8:~ #

Thoughts, please! Thanks!

In the windows world. you often need parameters to process a silent unattended installation.
And it heavly depend on the installer type

One way to figure it out is to install it once using cmd or powershell to determine th arguments.

For example if you want to install fireox, you need to do

    - name: install firefox
      ansible.windows.win_package:
        url_timeout: 120
        path: "https://download-installer.cdn.mozilla.net/pub/firefox/releases/{{ VERSION }}/win64/de/Firefox%20Setup%20{{ VERSION }}.exe"
        arguments:
          - -ms
      register: firefox_installation

and for fluent-bit, you’ll do

- name: install fluent-bit
  ansible.windows.win_package:
    path: C:\somedir\fluent-bit-{{ FBVERSION }}.exe
    validate_certs: false
    url_timeout: 120
    arguments:
      - /S
      - /D=C:\somedir
    wait_for_children: true

Excellent! Thanks very much for this information. @markuman !