37 lines
1.9 KiB
YAML
37 lines
1.9 KiB
YAML
---
|
|
- name: Debug bigboot_expansion_diff
|
|
ansible.builtin.debug:
|
|
msg: "{{ bigboot_expansion_diff }} + {{ bigboot_size_target_fallback }} <-> {{ bigboot_boot_partsize }}"
|
|
|
|
- name: Fail if /boot can't expand to at least 1GB
|
|
ansible.builtin.assert:
|
|
that: bigboot_size_target_fallback | int >= bigboot_size_min | human_to_bytes
|
|
fail_msg:
|
|
"{{ bigboot_size_target_fallback | int | human_readable(unit='M') }} is less than the minimum required size of {{ bigboot_size_min }}."
|
|
|
|
- name: Verify available space and re-check if needed
|
|
block:
|
|
- name: Assert that there is space on the logical volume for shrinkage
|
|
ansible.builtin.assert:
|
|
that: bigboot_lv_info['size_available'] > bigboot_expansion_diff | int
|
|
fail_msg: There is not enough free space available to shrink the filesystem
|
|
|
|
- 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') }})"
|
|
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:
|
|
- name: "Decrement size target by {{ bigboot_size_decrement }}"
|
|
ansible.builtin.set_fact:
|
|
bigboot_size_target_fallback: "{{ bigboot_size_target_fallback | int - bigboot_size_decrement | human_to_bytes }}"
|
|
|
|
- name: Update required expansion space
|
|
ansible.builtin.set_fact:
|
|
bigboot_expansion_diff:
|
|
"{{ (bigboot_size_target_fallback | int - bigboot_boot_partsize | human_to_bytes) }}"
|
|
|
|
- name: Re-check disk space - RESCUE
|
|
ansible.builtin.include_tasks: check_space_fallback.yml
|