--- - 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 or 'Windows 7' 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 - include_tasks: updates-all.yml when: - "'Windows Server 2008' not in ansible_distribution" - "'Windows 7' not in ansible_distribution" #- include_tasks: updates-powershell.yml # when: # - install_updates | bool # - "'Windows Server 2008' in ansible_distribution" - include_tasks: updates-win2008r2.yml when: - "'Windows Server 2008' in ansible_distribution or 'Windows 7' 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 or 'Windows 7' in ansible_distribution"