ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
205 stars 160 forks source link

Win_hotfix module fails to install cumulative update for Windows 11 #570

Open yadihng opened 4 months ago

yadihng commented 4 months ago
SUMMARY

When I run a playbook to install a Windows Cumulative Update for Windows 11 using the 'win_hotfix' module, it errors out stating "failed to get metadata xml inside MSU file, cannot get hotfix metadata required for this task".

In fact, when I expand the MSU (expand.exe -F:* ".\windows11.0-kb5039212-x64_2b67855a5e73c7a873e6bdca512c8c106b429196.msu" .), there's no xml file.

ISSUE TYPE
COMPONENT NAME

win_hotfix module

ANSIBLE VERSION
ansible 2.9.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/var/lib/shade/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.7.3 (default, Oct 11 2023, 09:51:27) [GCC 8.3.0]
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT

Windows 11 23H2

STEPS TO REPRODUCE
---

- name: Install hotfix
  hosts: MyTargetHost
  gather_facts: True

  tasks:
  - name: Install Windows 11 Hotfix
    win_hotfix:
      source: C:\hotfix\windows11.0-kb5039212-x64_2b67855a5e73c7a873e6bdca512c8c106b429196.msu
      state: present
    register: hotfix_install
EXPECTED RESULTS

I expect the hotfix to be installed.

ACTUAL RESULTS
Using module file /usr/lib/python3/dist-packages/ansible/modules/windows/win_hotfix.ps1
Pipelining is enabled.
<MyTargetHost> ESTABLISH WINRM CONNECTION FOR USER: USER on PORT 5985 TO MyTargetHost
EXEC (via pipeline wrapper)
fatal: [MyTargetHost]: FAILED! => {
    "changed": false,
    "msg": "failed to get metadata xml inside MSU file, cannot get hotfix metadata required for this task",
    "reboot_required": false
}
hiyokotaisa commented 1 week ago

Basically, this is not Ansible issue. MSU needs to have xml file so if there is no xml in the package, that need to be fixed on the package provider(Microsoft).

https://support.microsoft.com/en-us/topic/description-of-the-windows-update-standalone-installer-in-windows-799ba3df-ec7e-b05e-ee13-1cdae8f23b19