mirror of
https://git.ecdf.ed.ac.uk/win_automation/windows-ansible.git
synced 2026-10-29 16:46:51 +00:00
windows update task
This commit is contained in:
1 parent
91725c1d43
commit
f36bd67c5c
1 file changed
+29
-3
@@ -1,10 +1,36 @@
|
|||||||
---
|
---
|
||||||
- name: Install all updates and reboot as many times as needed
|
- name: Install all updates and reboot as many times as needed
|
||||||
tags: update_windows
|
tags: update_windows
|
||||||
ansible.windows.win_updates:
|
block:
|
||||||
category_names: '*'
|
- name: Install Windows updates (looped)
|
||||||
reboot: true
|
ansible.windows.win_updates:
|
||||||
|
category_names: '*'
|
||||||
|
reboot: true
|
||||||
|
register: update_result
|
||||||
|
retries: 5
|
||||||
|
delay: 30
|
||||||
|
until: update_result.reboot_required == false
|
||||||
|
|
||||||
|
- name: Wait for host to come back online
|
||||||
|
ansible.builtin.wait_for_connection:
|
||||||
|
timeout: 600
|
||||||
|
|
||||||
|
- name: Install all Windows updates and reboot if required
|
||||||
|
tags: update_windows1
|
||||||
|
block:
|
||||||
|
- name: Install Windows updates (no auto reboot)
|
||||||
|
ansible.windows.win_updates:
|
||||||
|
category_names: '*'
|
||||||
|
reboot: false
|
||||||
|
register: update_result
|
||||||
|
|
||||||
|
- name: Reboot the machine if updates require it
|
||||||
|
ansible.windows.win_reboot:
|
||||||
|
when: update_result.reboot_required
|
||||||
|
|
||||||
|
- name: Wait for the host to come back online
|
||||||
|
ansible.builtin.wait_for_connection:
|
||||||
|
timeout: 600
|
||||||
- name: Update all choco packages
|
- name: Update all choco packages
|
||||||
win_command: choco upgrade all -y
|
win_command: choco upgrade all -y
|
||||||
tags: update_choco
|
tags: update_choco
|
||||||
|
|||||||
Reference in new issue
Block a user