win_hotfix - install and uninstalls Windows hotfixes

New in version 2.4.

Synopsis

  • Install, uninstall a Windows hotfix.

Options

parameter required default choices comments
hotfix_identifier
no
The name of the hotfix as shown in DISM, see examples for details.
This or hotfix_kb MUST be set when state=absent.
If state=present then the hotfix at source will be validated against this value, if it does not match an error will occur.
You can get the identifier by running 'Get-WindowsPackage -Online -PackagePath path-to-cab-in-msu' after expanding the msu file.
hotfix_kb
no
The name of the KB the hotfix relates to, see examples for details.
This of hotfix_identifier MUST be set when state=absent.
If state=present then the hotfix at source will be validated against this value, if it does not match an error will occur.
Because DISM uses the identifier as a key and doesn't refer to a KB in all cases it is recommended to use hotfix_identifier instead.
source
no
The path to the downloaded hotfix .msu file.
This MUST be set if state=present and MUST be a .msu hotfix file.
state
no present
  • absent
  • present
Whether to install or uninstall the hotfix.
When present, source MUST be set.
When absent, hotfix_identifier or hotfix_kb MUST be set.

Examples

- name: install Windows ADK with DISM for Server 2008 R2
  win_chocolatey:
    name: windows-adk
    version: 8.100.26866.0
    state: present
    install_args: /features OptionId.DeploymentTools

- name: install hotfix without validating the KB and Identifier
  win_hotfix:
    source: C:\temp\windows8.1-kb3172729-x64_e8003822a7ef4705cbb65623b72fd3cec73fe222.msu
    state: present
  register: hotfix_install

- win_reboot:
  when: hotfix_install.reboot_required

- name: install hotfix validating KB
  win_hotfix:
    hotfix_kb: KB3172729
    source: C:\temp\windows8.1-kb3172729-x64_e8003822a7ef4705cbb65623b72fd3cec73fe222.msu
    state: present
  register: hotfix_install

- win_reboot:
  when: hotfix_install.reboot_required

- name: install hotfix validating Identifier
  win_hotfix:
    hotfix_identifier: Package_for_KB3172729~31bf3856ad364e35~amd64~~6.3.1.0
    source: C:\temp\windows8.1-kb3172729-x64_e8003822a7ef4705cbb65623b72fd3cec73fe222.msu
    state: present
  register: hotfix_install

- win_reboot:
  when: hotfix_install.reboot_required

- name: uninstall hotfix with Identifier
  win_hotfix:
    hotfix_identifier: Package_for_KB3172729~31bf3856ad364e35~amd64~~6.3.1.0
    state: absent
  register: hotfix_uninstall

- win_reboot:
  when: hotfix_uninstall.reboot_required

- name: uninstall hotfix with KB (not recommended)
  win_hotfix:
    hotfix_kb: KB3172729
    state: absent
  register: hotfix_uninstall

- win_reboot:
  when: hotfix_uninstall.reboot_required

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
identifier
The DISM identifier for the hotfix.
success str Package_for_KB3172729~31bf3856ad364e35~amd64~~6.3.1.0
kb
The KB the hotfix relates to.
success str KB3172729
reboot_required
Whether a reboot is required for the install or uninstall to finalise.
success str True

Notes

Note

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/win_hotfix_module.html