version 3.5
This commit is contained in:
@@ -1,20 +1,19 @@
|
||||
---
|
||||
- name: Patch DCs via JEA
|
||||
- name: Patch Domain Controllers via JEA
|
||||
hosts: domain_controllers
|
||||
gather_facts: no
|
||||
|
||||
tasks:
|
||||
- name: List available updates
|
||||
ansible.windows.win_powershell:
|
||||
Get-WindowsUpdate -MicrosoftUpdate -AcceptAll -IgnoreReboot
|
||||
register: available_updates
|
||||
changed_when: false
|
||||
- name: Get available updates
|
||||
win_shell: |
|
||||
Invoke-Command -ConfigurationName DCMaintenance -ScriptBlock { Get-WindowsUpdate }
|
||||
|
||||
- name: Install updates
|
||||
ansible.windows.win_powershell:
|
||||
Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -Verbose
|
||||
register: install_result
|
||||
|
||||
|
||||
win_shell: |
|
||||
Invoke-Command -ConfigurationName DCMaintenance -ScriptBlock { Install-WindowsUpdate -AcceptAll -AutoReboot }
|
||||
|
||||
- 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 }
|
||||
|
||||
Reference in New Issue
Block a user