From f7c135d5d28986f23632b8a257105f0139328b75 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 16 Feb 2024 00:49:19 -0500 Subject: [PATCH] regex fixes and cleanup --- bigboot-v3.yml | 8 -------- tasks/bigboot_manage_lv.yml | 5 ++--- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/bigboot-v3.yml b/bigboot-v3.yml index 1c47dac..4d3fcda 100644 --- a/bigboot-v3.yml +++ b/bigboot-v3.yml @@ -5,20 +5,12 @@ gather_facts: true tasks: - - name: Debug bigboot_size - ansible.builtin.debug: - var: bigboot_size - - name: Capture boot device details ansible.builtin.import_tasks: tasks/capture_boot_device_details.yml - name: Shrink a logical volume for /boot expansion if needed ansible.builtin.import_tasks: tasks/bigboot_manage_lv.yml - - name: Debug bigboot_size - ansible.builtin.debug: - var: bigboot_size - - name: Expand the /boot partition as requested ansible.builtin.import_role: name: infra.lvm_snapshots.bigboot diff --git a/tasks/bigboot_manage_lv.yml b/tasks/bigboot_manage_lv.yml index ede91b8..c0c0eb2 100644 --- a/tasks/bigboot_manage_lv.yml +++ b/tasks/bigboot_manage_lv.yml @@ -48,14 +48,14 @@ # Ex: # Free PE / Size 320 / 1.25 GiB" # Free PE / Size 189 / 756.00 MiB" + # Free PE / Size 414 / <1.62 GiB # Free PE / Size 0 / 0 - bigboot_lv_vg_free_pe: "{{ bigboot_lv_vg_free_pe.stdout | regex_replace('^.*/.*/\\s+(.*)', '\\1') }}" + bigboot_lv_vg_free_pe: "{{ bigboot_lv_vg_free_pe.stdout | regex_replace('^.*/.*/\\s+[<]?(.*)', '\\1') }}" - name: Get size only from the values ansible.builtin.set_fact: bigboot_lv_size_in_mb: "{{ bigboot_lv_vg_free_pe | regex_replace('i|\\s+|<', '') | human_to_bytes | human_readable(unit='M') }}" - # "{{ bigboot_lv_vg_free_pe | regex_replace('i', '') | regex_replace(' ', '') | human_to_bytes | human_readable(unit='M') }}" bigboot_size_in_mb: "{{ bigboot_size[:-1] }}" - name: Check if we can shrink the logical volume @@ -65,7 +65,6 @@ that: - bigboot_lv_vg_free_pe[:-4] != '' - (bigboot_lv_size_in_mb[:-6] | int - bigboot_size_in_mb | int ) >= 0 - # - (bigboot_lv_info.size_available - bigboot_size | human_to_bytes) >= 0 fail_msg: Not enough free PE available for /boot expansion. rescue: