version 3.5

This commit is contained in:
2025-09-09 09:39:26 +02:00
parent 37c6298fea
commit c61f39f5fb

View File

@@ -1,20 +1,19 @@
--- - name: Patch Domain Controllers via JEA
- name: Patch DCs via JEA
hosts: domain_controllers hosts: domain_controllers
gather_facts: no gather_facts: no
tasks: tasks:
- name: List available updates - name: Get available updates
ansible.windows.win_powershell: win_shell: |
Get-WindowsUpdate -MicrosoftUpdate -AcceptAll -IgnoreReboot Invoke-Command -ConfigurationName DCMaintenance -ScriptBlock { Get-WindowsUpdate }
register: available_updates
changed_when: false
- name: Install updates - name: Install updates
ansible.windows.win_powershell: win_shell: |
Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -Verbose Invoke-Command -ConfigurationName DCMaintenance -ScriptBlock { Install-WindowsUpdate -AcceptAll -AutoReboot }
register: install_result
- name: Get update history
win_shell: |
Invoke-Command -ConfigurationName DCMaintenance -ScriptBlock { Get-WUHistory }
- name: Restart domain controller
win_shell: |
Invoke-Command -ConfigurationName DCMaintenance -ScriptBlock { Restart-Computer -Force }