vn-ansible/playbooks/windows-update.yml

28 lines
875 B
YAML
Raw Normal View History

- hosts: all
2023-11-21 14:38:57 +00:00
serial: 1
tasks:
- block:
2024-09-23 12:30:38 +00:00
- name: Check if there are missing updates
2023-11-21 14:38:57 +00:00
win_updates: state=searched
register: update_count
- block:
2024-09-23 12:30:38 +00:00
- name: Install missing updates only if at least one is missing
2023-11-21 14:38:57 +00:00
win_updates:
category_names: '*'
#- Application
#- Connectors
#- DefinitionUpdates
#- DeveloperKits
#- FeaturePacks
#- Guidance
#- ServicePacks
#- Tools
#- UpdateRollups
#- CriticalUpdates
#- SecurityUpdates
2024-09-23 12:30:38 +00:00
log_path: C:\Win_Template_Patch.log
register: update_result
2023-11-21 14:38:57 +00:00
- name: Reboot, if needed.
win_reboot:
when: update_result.reboot_required
when: update_count.found_update_count|int >= 1