3
This commit is contained in:
@@ -1,23 +1,18 @@
|
||||
---
|
||||
- name: Patch Domain Controllers via SYSTEM task
|
||||
- name: Patch DCs directly via JEA (no scheduled task)
|
||||
hosts: domain_controllers
|
||||
gather_facts: no
|
||||
|
||||
tasks:
|
||||
- name: Start the SYSTEM patch task
|
||||
community.windows.win_scheduled_task:
|
||||
name: "Patching-windows-task"
|
||||
state: started
|
||||
|
||||
- name: Wait for task to finish
|
||||
community.windows.win_scheduled_task_stat:
|
||||
name: "Patching-windows-task"
|
||||
register: taskstat
|
||||
until: taskstat.task.state in ['Ready','Disabled']
|
||||
retries: 180
|
||||
delay: 60
|
||||
|
||||
- name: Reboot if required
|
||||
ansible.windows.win_reboot:
|
||||
- name: Install security & critical updates
|
||||
ansible.windows.win_updates:
|
||||
category_names:
|
||||
- SecurityUpdates
|
||||
- CriticalUpdates
|
||||
reboot: yes
|
||||
reboot_timeout: 3600
|
||||
when: taskstat.task.state == 'Ready'
|
||||
register: updates_result
|
||||
|
||||
- name: Show summary
|
||||
ansible.builtin.debug:
|
||||
var: updates_result
|
||||
|
||||
Reference in New Issue
Block a user