diff --git a/tasks/capture_lv_device_details.yml b/tasks/capture_lv_device_details.yml index a0d413b..c220899 100644 --- a/tasks/capture_lv_device_details.yml +++ b/tasks/capture_lv_device_details.yml @@ -73,9 +73,6 @@ ansible.builtin.debug: 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 - - name: Capture logical volume name ansible.builtin.shell: cmd: | @@ -98,6 +95,26 @@ changed_when: false register: bigboot_lv_vg_free_pe +- name: Capture volume group PE size + ansible.builtin.shell: + cmd: | + set -o pipefail + vgdisplay {{ bigboot_lv_vg_name | trim }} | grep -i 'pe size' + executable: /bin/bash + changed_when: false + register: bigboot_lv_vg_pe_capture + +- name: Set PE size + ansible.builtin.set_fact: + bigboot_lv_vg_pe_size: "{{ bigboot_lv_vg_pe_capture | regex_replace('^.*\\s+(\\d+.\\d+).*$', '\\1M') | human_to_bytes }}" + +- name: Subtract one additional PE for shrinking + ansible.builtin.set_fact: + bigboot_lv_shrink_size: "{{ bigboot_lv_shrink_size | int - bigboot_lv_vg_pe_size | int }}" + +# - name: Kill the play +# ansible.builtin.meta: end_host + - name: Capture the PV device ansible.builtin.set_fact: bigboot_pv: "{{ bigboot_boot_mount['device'][:-1] }}{{ bigboot_boot_mount['device'][-1:] | int + 1 }}"