Update role dependencies
This commit is contained in:
@@ -1,72 +1,40 @@
|
||||
---
|
||||
|
||||
- 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
|
||||
- include_tasks: install_dism.yml
|
||||
|
||||
- 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: check installed kbs
|
||||
win_shell: wmic qfe | ConvertTo-Json
|
||||
register: installed_kbs
|
||||
|
||||
- name: download hotfix group 1
|
||||
win_get_url:
|
||||
url: '{{ item.url }}'
|
||||
dest: '{{ hotfix_download_location }}\{{ item.file }}'
|
||||
loop: "{{ hotfixes_group_1 }}"
|
||||
- name: missing hotfixes
|
||||
set_fact:
|
||||
missing_hotfixes: "{{ hotfixes | json_query(query) }}"
|
||||
vars:
|
||||
set_installed_kbs: "{{ (installed_kbs.stdout | from_json) | reject('match', '^$') | reject('match', '^Caption *') | map('regex_replace', '^.* (KB[0-9]+) .*', '\\1') | list }}"
|
||||
query: "[?!contains(`{{ set_installed_kbs }}`, kb)]"
|
||||
|
||||
- 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:
|
||||
- include_role:
|
||||
name: "{{ windows_hotfix_role }}"
|
||||
loop: "{{ missing_hotfixes }}"
|
||||
loop_control:
|
||||
loop_var: hotfix
|
||||
|
||||
- name: check for available updates
|
||||
win_updates:
|
||||
server_selection: "{{ win_update_server_selection }}"
|
||||
category_names: "{{ win_update_category_names }}"
|
||||
blacklist: "{{ win_update_blacklist | default(omit) }}"
|
||||
reject_list: "{{ win_update_reject_list | default(omit) }}"
|
||||
state: searched
|
||||
register: available_updates
|
||||
|
||||
- debug:
|
||||
msg: |
|
||||
msg: "{{ _msg.split('\n')[:-1] }}"
|
||||
vars:
|
||||
_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
|
||||
|
||||
@@ -77,6 +45,7 @@
|
||||
|
||||
- name: check for missing updates.
|
||||
win_updates:
|
||||
server_selection: "{{ win_update_server_selection }}"
|
||||
state: searched
|
||||
register: available_updates
|
||||
|
||||
|
||||
Reference in New Issue
Block a user