Add functions to filter plugin; Tweaks

This commit is contained in:
2025-06-05 02:51:07 -04:00
parent 5cb1b9d68f
commit a3d5c17253
3 changed files with 16 additions and 4 deletions

View File

@ -66,12 +66,12 @@
- name: Capture shrink and fallback sizes
ansible.builtin.set_fact:
# we need to get the BLOCK size total, not the filesystem
bigboot_lv_shrink_size: "{{ bigboot_lv_partsize | int - bigboot_expansion_diff | int }}"
bigboot_lv_shrink_size: "{{ (bigboot_lv_partsize | int - bigboot_expansion_diff | int) | get_block_size_down_bytes }}"
bigboot_size_target_fallback: "{{ bigboot_size_target_fallback | int | human_readable(unit='G') | regex_replace('\\sGB', 'G') }}"
- name: Debug bigboot_lv_shrink_size and bigboot_size_target_fallback
ansible.builtin.debug:
msg: "{{ bigboot_lv_shrink_size | int | human_readable(unit='G') }} ({{ bigboot_lv_shrink_size }}) <-> {{ bigboot_size_target_fallback }} | {{ bigboot_expansion_diff }}"
msg: "{{ bigboot_lv_shrink_size | int | human_readable(unit='G') }} ({{ bigboot_lv_shrink_size | int | human_readable(unit='M') | regex_replace('\\.\\d+\\s+MB') | int | get_block_size_down }}) <-> {{ bigboot_size_target_fallback }} | {{ bigboot_expansion_diff }}"
# - name: Kill the play
# ansible.builtin.meta: end_host

View File

@ -19,7 +19,7 @@
- name: Assert that there will be enough space left over on the target LV
ansible.builtin.assert:
that: (bigboot_lv_info['size_available'] - bigboot_expansion_diff | int) >= bigboot_lv_size_min | human_to_bytes
success_msg: "There will be enough space left over with a boot size of {{ bigboot_size_target_fallback | int | human_readable(unit='G') }}. ({{ (bigboot_lv_info['size_total'] - bigboot_expansion_diff | int) | human_readable(unit='B') }})"
# success_msg: "There will be enough space left over with a boot size of {{ bigboot_size_target_fallback | int | human_readable(unit='G') }}. ({{ (bigboot_lv_info['size_total'] - bigboot_expansion_diff | int) | human_readable(unit='B') }})"
fail_msg: "There will NOT be enough space left over with a boot size of {{ bigboot_size_target_fallback | int | human_readable(unit='G') }}."
rescue: