pridan pozadavek na rec. partition alespon 500MB
This commit is contained in:
@@ -46,6 +46,32 @@
|
||||
winre_parts: "{{ [winre_parts] }}"
|
||||
when: winre_parts is mapping
|
||||
|
||||
# --- threshold (MiB) -> bytes
|
||||
- name: Set Recovery size threshold
|
||||
ansible.builtin.set_fact:
|
||||
recovery_threshold_mib: 500
|
||||
recovery_threshold_bytes: "{{ 500 * 1024 * 1024 }}"
|
||||
changed_when: false
|
||||
|
||||
# Smallest Recovery partition on this host (if any)
|
||||
- name: Compute smallest Recovery partition size (bytes)
|
||||
ansible.builtin.set_fact:
|
||||
recovery_min_bytes: "{{ (winre_parts | map(attribute='SizeBytes') | list) | min }}"
|
||||
when: winre_parts | length > 0
|
||||
changed_when: false
|
||||
|
||||
# Fail this host if it has a Recovery partition smaller than 500 MiB
|
||||
- name: Enforce minimum Recovery partition size
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Recovery partition too small on {{ inventory_hostname }}:
|
||||
smallest={{ (recovery_min_bytes / 1024 / 1024) | round(2) }} MiB,
|
||||
required >= {{ recovery_threshold_mib }} MiB.
|
||||
Details: {{ winre_parts }}
|
||||
when:
|
||||
- winre_parts | length > 0
|
||||
- recovery_min_bytes < recovery_threshold_bytes
|
||||
|
||||
- name: Show Recovery partition sizes
|
||||
ansible.builtin.debug:
|
||||
msg: "Disk {{ item.DiskNumber }}, Part {{ item.PartitionNumber }}, Size: {{ item.SizeMB }} MB ({{ item.SizeBytes }} bytes)"
|
||||
|
||||
Reference in New Issue
Block a user