89 lines
3.6 KiB
YAML
89 lines
3.6 KiB
YAML
---
|
|
|
|
- name: disable firewall for Domain, Public and Private profiles
|
|
win_shell: Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
|
|
when: "'Windows Server 2012' in ansible_distribution"
|
|
|
|
- name: disable firewall for Domain, Public and Private profiles
|
|
win_shell: netsh advfirewall set allprofiles state off
|
|
when: "'Windows Server 2008' in ansible_distribution"
|
|
|
|
- name: get used space before update
|
|
win_shell: Get-PSDrive C | Select-Object Used | ConvertTo-Json
|
|
register: used_space_before_update
|
|
ignore_errors: yes
|
|
|
|
- name: update Windows Update Agent on 2008
|
|
win_package:
|
|
path: http://download.windowsupdate.com/windowsupdate/redist/standalone/7.6.7600.320/windowsupdateagent-7.6-x64.exe
|
|
arguments:
|
|
- /quiet
|
|
- /norestart
|
|
- /wuforce
|
|
creates_path: C:\Windows\System32\wuaueng.dll
|
|
creates_version: 7.6.7600.320
|
|
when: "'Windows Server 2008' in ansible_distribution"
|
|
|
|
- include_tasks: updates-all.yml
|
|
vars:
|
|
win_update_category_names:
|
|
- CriticalUpdates
|
|
- DefinitionUpdates
|
|
- SecurityUpdates
|
|
- UpdateRollups
|
|
- Updates
|
|
when:
|
|
- install_updates | bool
|
|
- "'Windows Server 2008' not in ansible_distribution"
|
|
|
|
#- include_tasks: updates-powershell.yml
|
|
# when:
|
|
# - install_updates | bool
|
|
# - "'Windows Server 2008' in ansible_distribution"
|
|
|
|
- include_tasks: updates-win2008r2.yml
|
|
vars:
|
|
win_update_category_names:
|
|
- CriticalUpdates
|
|
- DefinitionUpdates
|
|
- SecurityUpdates
|
|
- UpdateRollups
|
|
- Updates
|
|
hotfix_download_location: "{{ ansible_env.TEMP }}"
|
|
hotfixes_group_1:
|
|
- kb: KB3020369
|
|
file: Windows6.1-KB3020369-x64.msu
|
|
url: https://download.microsoft.com/download/F/D/3/FD3728D5-0D2F-44A6-B7DA-1215CC0C9B75/Windows6.1-KB3020369-x64.msu
|
|
- kb: KB3125574
|
|
file: windows6.1-kb3125574-v4-x64_2dafb1d203c8964239af3048b5dd4b1264cd93b9.msu
|
|
url: http://download.windowsupdate.com/d/msdownload/update/software/updt/2016/05/windows6.1-kb3125574-v4-x64_2dafb1d203c8964239af3048b5dd4b1264cd93b9.msu
|
|
- kb: KB4474419
|
|
file: windows6.1-kb4474419-v3-x64_b5614c6cea5cb4e198717789633dca16308ef79c.msu
|
|
url: http://download.windowsupdate.com/c/msdownload/update/software/secu/2019/09/windows6.1-kb4474419-v3-x64_b5614c6cea5cb4e198717789633dca16308ef79c.msu
|
|
- kb: KB4490628
|
|
file: windows6.1-kb4490628-x64_d3de52d6987f7c8bdc2c015dca69eac96047c76e.msu
|
|
url: http://download.windowsupdate.com/c/msdownload/update/software/secu/2019/03/windows6.1-kb4490628-x64_d3de52d6987f7c8bdc2c015dca69eac96047c76e.msu
|
|
when:
|
|
- install_updates | bool
|
|
- "'Windows Server 2008' in ansible_distribution"
|
|
|
|
- name: get used space after update
|
|
win_shell: Get-PSDrive C | Select-Object Used | ConvertTo-Json
|
|
register: used_space_after_update
|
|
ignore_errors: yes
|
|
|
|
- debug:
|
|
msg:
|
|
- "Used space before update: {{ ((used_space_before_update.stdout | from_json)['Used']|int / (1024*1024*1024)) | round(2, 'floor') }} GB"
|
|
- "Used space after update: {{ ((used_space_after_update.stdout | from_json)['Used']|int / (1024*1024*1024)) | round(2, 'floor') }} GB"
|
|
when:
|
|
- used_space_before_update.stdout is defined
|
|
- used_space_after_update.stdout is defined
|
|
|
|
- name: enabled firewall for Domain, Public and Private profiles
|
|
win_shell: Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True
|
|
when: "'Windows Server 2012' in ansible_distribution"
|
|
|
|
- name: enable firewall for Domain, Public and Private profiles
|
|
win_shell: netsh advfirewall set allprofiles state on
|
|
when: "'Windows Server 2008' in ansible_distribution" |