test cteni rec. partition pomoci Powershell
This commit is contained in:
@@ -20,25 +20,20 @@
|
|||||||
when:
|
when:
|
||||||
- freediskspace.stdout | trim | float < 20
|
- freediskspace.stdout | trim | float < 20
|
||||||
|
|
||||||
- name: Gather disk & partition facts
|
- name: Find Recovery partitions and sizes (MB)
|
||||||
community.windows.win_disk_facts:
|
ansible.windows.win_powershell:
|
||||||
|
script: |
|
||||||
|
$guid = '{DE94BBA4-06D1-4D40-A16A-BFD50179D6AC}'
|
||||||
|
$parts = Get-Partition |
|
||||||
|
Where-Object {
|
||||||
|
$_.GptType -eq $guid -or $_.Type -eq 'Recovery' -or $_.Type -eq 'Unknown'
|
||||||
|
} |
|
||||||
|
Select-Object DiskNumber, PartitionNumber,
|
||||||
|
@{n='SizeMB';e={[math]::Round($_.Size/1MB,2)}},
|
||||||
|
GptType, Type
|
||||||
|
$parts | ConvertTo-Json -Compress
|
||||||
|
register: winre_parts
|
||||||
|
|
||||||
- name: Show Recovery partition sizes (handles GPT + MBR)
|
- name: Show results
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: >-
|
var: winre_parts.output | from_json
|
||||||
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)
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
Reference in New Issue
Block a user