Fixes to assertion logic, and cleanup of unused stuffs
This commit is contained in:
parent
2d7764c183
commit
a64abecc65
@ -21,14 +21,6 @@
|
|||||||
bigboot_expansion_diff:
|
bigboot_expansion_diff:
|
||||||
"{{ bigboot_size_target | human_to_bytes - bigboot_boot_partsize | human_to_bytes }}"
|
"{{ bigboot_size_target | human_to_bytes - bigboot_boot_partsize | human_to_bytes }}"
|
||||||
|
|
||||||
- name: Convert size difference to MB
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
bigboot_size_expansion_mb: "{{ bigboot_expansion_diff | int | human_readable(unit='M') }}"
|
|
||||||
|
|
||||||
- name: Set bigboot size 4k aligned
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
bigboot_size: "{{ bigboot_size_expansion_mb[:-2] | int | get_block_size_up }}"
|
|
||||||
|
|
||||||
- name: Validate if we need to expand boot
|
- name: Validate if we need to expand boot
|
||||||
block:
|
block:
|
||||||
- name: Set flag for Bigboot execution
|
- name: Set flag for Bigboot execution
|
||||||
@ -48,4 +40,7 @@
|
|||||||
|
|
||||||
- name: Expansion of /boot required
|
- name: Expansion of /boot required
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "Will need to expand /boot by an additional {{ bigboot_size }}."
|
msg: >
|
||||||
|
Expansion of /boot is required.
|
||||||
|
Will attempt to increase to {{ bigboot_size_target }}, or
|
||||||
|
{{ bigboot_size_min }} at the least."
|
||||||
|
@ -47,11 +47,11 @@
|
|||||||
# that: bigboot_lv_info.size_available > bigboot_expansion_diff | int
|
# that: bigboot_lv_info.size_available > bigboot_expansion_diff | int
|
||||||
# fail_msg: There is not enough space available for LV shrinking.
|
# fail_msg: There is not enough space available for LV shrinking.
|
||||||
|
|
||||||
- name: Copy size target to temporary variable
|
- name: Set initial target size for fallback
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
bigboot_size_target_fallback: "{{ bigboot_size_target | human_to_bytes }}"
|
bigboot_size_target_fallback: "{{ bigboot_size_target | human_to_bytes }}"
|
||||||
|
|
||||||
- name: Check for available space and fallback if needed
|
- name: Check available space and fallback to lower /boot size if required
|
||||||
ansible.builtin.include_tasks: check_space_fallback.yml
|
ansible.builtin.include_tasks: check_space_fallback.yml
|
||||||
|
|
||||||
- name: Capture shrink and fallback sizes
|
- name: Capture shrink and fallback sizes
|
||||||
@ -59,10 +59,6 @@
|
|||||||
bigboot_lv_shrink_size: "{{ bigboot_lv_info['size_total'] - bigboot_expansion_diff | int }}"
|
bigboot_lv_shrink_size: "{{ bigboot_lv_info['size_total'] - bigboot_expansion_diff | int }}"
|
||||||
bigboot_size_target_fallback: "{{ bigboot_size_target_fallback | int | human_readable(unit='G') | regex_replace('\\sGB', 'G') }}"
|
bigboot_size_target_fallback: "{{ bigboot_size_target_fallback | int | human_readable(unit='G') | regex_replace('\\sGB', 'G') }}"
|
||||||
|
|
||||||
# - name: Debug sizes
|
|
||||||
# ansible.builtin.debug:
|
|
||||||
# msg: "{{ bigboot_lv_shrink_size }} <-> {{ bigboot_size_target_fallback }}"
|
|
||||||
|
|
||||||
- name: Capture logical volume name
|
- name: Capture logical volume name
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: |
|
cmd: |
|
||||||
@ -109,13 +105,19 @@
|
|||||||
|
|
||||||
- name: Verify available PE for the volume group
|
- name: Verify available PE for the volume group
|
||||||
block:
|
block:
|
||||||
- name: Set flag for Shrink_LV execution
|
- name: Set required variables for shrinking the target LV
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
bigboot_execute_shrink_lv: false
|
bigboot_execute_shrink_lv: false
|
||||||
|
bigboot_expansion_diff_mb: "{{ bigboot_expansion_diff | int | human_readable(unit='M') }}"
|
||||||
|
|
||||||
- name: Assert if we need to execute the shrink_lv role to gain free PE
|
- name: Debug even more sizes
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "{{ bigboot_lv_pe_size_in_mb[:-3] | int }} <-> {{ bigboot_expansion_diff_mb[:-3] | int }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Assert if we need to shrink the logical volume to gain PE
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: (bigboot_lv_pe_size_in_mb[:-3] | int | round) | int > bigboot_size[:-1] | int
|
that: (bigboot_lv_pe_size_in_mb[:-3] | int) >= (bigboot_expansion_diff_mb[:-3] | int)
|
||||||
fail_msg: Not enough PE to expand /boot.
|
fail_msg: Not enough PE to expand /boot.
|
||||||
|
|
||||||
rescue:
|
rescue:
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
- name: Fail if /boot can't expand to at least 1GB
|
- name: Fail if /boot can't expand to at least 1GB
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: bigboot_size_target_fallback | human_to_bytes > bigboot_size_min | human_to_bytes
|
that: bigboot_size_target_fallback | human_to_bytes >= bigboot_size_min | human_to_bytes
|
||||||
fail_msg: "{{ bigboot_size_target_fallback | int | human_readable(unit='M') }} is less than the minimum of 1GB for /boot"
|
fail_msg: "{{ bigboot_size_target_fallback | int | human_readable(unit='M') }} is less than the minimum of 1GB for /boot"
|
||||||
|
|
||||||
- name: Verify available space and re-check if needed
|
- name: Verify available space and re-check if needed
|
||||||
@ -23,7 +23,7 @@
|
|||||||
- name: Update required expansion space
|
- name: Update required expansion space
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
bigboot_expansion_diff:
|
bigboot_expansion_diff:
|
||||||
"{{ bigboot_size_target_fallback | human_to_bytes - bigboot_boot_partsize | human_to_bytes }}"
|
"{{ (bigboot_size_target_fallback | human_to_bytes - bigboot_boot_partsize | human_to_bytes) }}"
|
||||||
|
|
||||||
- name: Re-check disk space - RESCUE
|
- name: Re-check disk space - RESCUE
|
||||||
ansible.builtin.include_tasks: check_space_fallback.yml
|
ansible.builtin.include_tasks: check_space_fallback.yml
|
||||||
|
Loading…
x
Reference in New Issue
Block a user