85 lines
2.5 KiB
YAML
85 lines
2.5 KiB
YAML
---
|
|
|
|
- name: ensure Windows ADK with DISM is installed
|
|
win_chocolatey:
|
|
name: windows-adk-deploy
|
|
state: present
|
|
version: 10.0.17134.0
|
|
register: install_windows_adk_deploy
|
|
notify: ensure Windows ADK with DISM is removed
|
|
|
|
- name: ensure PATH contains Windows ADK
|
|
win_path:
|
|
scope: machine
|
|
state: present
|
|
elements: "C:\\Program Files (x86)\\Windows Kits\\10\\Assessment and Deployment Kit\\Deployment Tools\\amd64\\DISM"
|
|
|
|
- name: download hotfix group 1
|
|
win_get_url:
|
|
url: '{{ item.url }}'
|
|
dest: '{{ hotfix_download_location }}\{{ item.file }}'
|
|
loop: "{{ hotfixes_group_1 }}"
|
|
|
|
- block:
|
|
- name: install hotfix group 1 (PS >= 4)
|
|
win_hotfix:
|
|
source: '{{ hotfix_download_location }}\{{ item.file }}'
|
|
state: present
|
|
register: hotfix_install_group_1
|
|
loop: "{{ hotfixes_group_1 }}"
|
|
when: ansible_powershell_version is version('4', '>=')
|
|
rescue:
|
|
- name: install hotfix using shell
|
|
win_shell: '{{ hotfix_download_location }}\{{ item.file }} /quiet /norestart'
|
|
register: hotfix_install_group_1
|
|
loop: "{{ hotfixes_group_1 }}"
|
|
|
|
- name: install hotfix (PS == 3)
|
|
win_shell: '{{ hotfix_download_location }}\{{ item.file }} /quiet /norestart'
|
|
register: hotfix_install_group_1
|
|
loop: "{{ hotfixes_group_1 }}"
|
|
when: ansible_powershell_version is version('3', '==')
|
|
|
|
- name: debug hotfix installation result
|
|
debug:
|
|
var: hotfix_install_group_1
|
|
|
|
- name: ensure hotfix file is removed (group 1)
|
|
win_file:
|
|
path: '{{ hotfix_download_location }}\{{ item.file }}'
|
|
state: absent
|
|
loop: "{{ hotfixes_group_1 }}"
|
|
|
|
- name: reboot from starting update
|
|
win_reboot:
|
|
|
|
- name: check for available updates
|
|
win_updates:
|
|
category_names: "{{ win_update_category_names }}"
|
|
blacklist: "{{ win_update_blacklist | default(omit) }}"
|
|
state: searched
|
|
register: available_updates
|
|
|
|
- debug:
|
|
msg: |
|
|
{{ inventory_hostname }} has {{ available_updates.found_update_count }} updates available.
|
|
{% for update in updates %}
|
|
- {{ update.title }}
|
|
{% endfor %}
|
|
vars:
|
|
updates: "{{ (available_updates.updates.values() | list) if (available_updates.updates is mapping) else (available_updates.updates) }}"
|
|
when: available_updates.updates is defined
|
|
|
|
- include_tasks: updates-with-retry.yml
|
|
when:
|
|
- available_updates.updates is defined
|
|
- available_updates.found_update_count > 0
|
|
|
|
- name: check for missing updates.
|
|
win_updates:
|
|
state: searched
|
|
register: available_updates
|
|
|
|
- name: list missing updates
|
|
debug:
|
|
var: available_updates |