vn-ansible/playbooks/win-update.yml

29 lines
853 B
YAML
Raw Normal View History

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