community / community.windows / 2.2.0 / module / win_hotfix Install and uninstalls Windows hotfixes Authors: Jordan Borean (@jborean93)community.windows.win_hotfix (2.2.0) — module
Install with ansible-galaxy collection install community.windows:==2.2.0
collections: - name: community.windows version: 2.2.0
Install, uninstall a Windows hotfix.
- name: Install Windows ADK with DISM for Server 2008 R2 chocolatey.chocolatey.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 community.windows.win_hotfix: source: C:\temp\windows8.1-kb3172729-x64_e8003822a7ef4705cbb65623b72fd3cec73fe222.msu state: present register: hotfix_install
- ansible.windows.win_reboot: when: hotfix_install.reboot_required
- name: Install hotfix validating KB community.windows.win_hotfix: hotfix_kb: KB3172729 source: C:\temp\windows8.1-kb3172729-x64_e8003822a7ef4705cbb65623b72fd3cec73fe222.msu state: present register: hotfix_install
- ansible.windows.win_reboot: when: hotfix_install.reboot_required
- name: Install hotfix validating Identifier community.windows.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
- ansible.windows.win_reboot: when: hotfix_install.reboot_required
- name: Uninstall hotfix with Identifier community.windows.win_hotfix: hotfix_identifier: Package_for_KB3172729~31bf3856ad364e35~amd64~~6.3.1.0 state: absent register: hotfix_uninstall
- ansible.windows.win_reboot: when: hotfix_uninstall.reboot_required
- name: Uninstall hotfix with KB (not recommended) community.windows.win_hotfix: hotfix_kb: KB3172729 state: absent register: hotfix_uninstall
- ansible.windows.win_reboot: when: hotfix_uninstall.reboot_required
state: choices: - absent - present default: present description: - Whether to install or uninstall the hotfix. - When C(present), C(source) MUST be set. - When C(absent), C(hotfix_identifier) or C(hotfix_kb) MUST be set. type: str source: description: - The path to the downloaded hotfix .msu file. - This MUST be set if C(state=present) and MUST be a .msu hotfix file. type: path hotfix_kb: description: - The name of the KB the hotfix relates to, see examples for details. - This or C(hotfix_identifier) MUST be set when C(state=absent). - If C(state=present) then the hotfix at C(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 C(hotfix_identifier) instead. type: str hotfix_identifier: description: - The name of the hotfix as shown in DISM, see examples for details. - This or C(hotfix_kb) MUST be set when C(state=absent). - If C(state=present) then the hotfix at C(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. type: str
identifier: description: The DISM identifier for the hotfix. returned: success sample: Package_for_KB3172729~31bf3856ad364e35~amd64~~6.3.1.0 type: str identifiers: description: The DISM identifiers for each hotfix in the msu. elements: str returned: success sample: - Package_for_KB3172729~31bf3856ad364e35~amd64~~6.3.1.0 type: list version_added: 1.10.0 version_added_collection: community.windows kb: description: The KB the hotfix relates to. returned: success sample: KB3172729 type: str kbs: description: The KB for each hotfix in the msu, elements: str returned: success sample: - KB3172729 type: list version_added: 1.10.0 version_added_collection: community.windows reboot_required: description: Whether a reboot is required for the install or uninstall to finalise. returned: success sample: true type: str