22 lines
924 B
YAML
22 lines
924 B
YAML
- name: debug
|
|
debug:
|
|
msg: "{{a_mounts}}"
|
|
|
|
|
|
- name: Set a constant defining number of Bytes in 1 GB
|
|
set_fact:
|
|
const_bytes_in_gb: 1073741824
|
|
|
|
- name: filter out directories that are not a mount path
|
|
set_fact:
|
|
mounted_dirs: "{{ a_mounts |map(attribute='mount') | intersect(volumes|map(attribute='mount')|list)}}"
|
|
|
|
- name: loop on existing volumes, check available space
|
|
fail:
|
|
msg: "Minimum required for {{ item.mount }}: {{ volumes | selectattr('mount', 'equalto', item.mount) | map(attribute='min_size') | list | join('') }}G - volume free space: {{ (item.size_available|int / const_bytes_in_gb|int) |round(1) }}G"
|
|
failed_when: "(volumes | selectattr('mount', 'equalto', item.mount) | map(attribute='min_size') | list | join('')|int) > (item.size_available|int / const_bytes_in_gb|int) |int"
|
|
loop: "{{ a_mounts }}"
|
|
loop_control:
|
|
label: "{{ item.mount }}"
|
|
when: "item.mount in mounted_dirs"
|