diff --git a/www-windows-check-free-disk-space.yaml b/www-windows-check-free-disk-space.yaml index eca6cc2..6b837ce 100644 --- a/www-windows-check-free-disk-space.yaml +++ b/www-windows-check-free-disk-space.yaml @@ -18,4 +18,32 @@ fail: msg: "the node {{ inventory_hostname }} has insufficient disk space: {{ freediskspace.stdout | trim }} GB (minimum required: 20 GB)" when: - - freediskspace.stdout | trim | float < 20 \ No newline at end of file + - freediskspace.stdout | trim | float < 20 + + - name: Get partition facts + hosts: windows + gather_facts: no + tasks: + + - name: Gather disk & partition facts + community.windows.win_disk_facts: + + - name: Show Recovery partition sizes (handles GPT + MBR) + ansible.builtin.debug: + msg: >- + Recovery partition (part {{ item.number|default('n/a') }}, offset {{ item.offset }}) + size: {{ item.size | filesizeformat }} + loop: >- + {{ + ( + ansible_facts.disks | map(attribute='partitions') | list | flatten + | selectattr('gpt_type','defined') + | selectattr('gpt_type','search','(?i)de94bba4-06d1-4d40-a16a-bfd50179d6ac') + ) + + + ( + ansible_facts.disks | map(attribute='partitions') | list | flatten + | selectattr('mbr_type','defined') + | selectattr('mbr_type','equalto',27) + ) + }}