regex fixes and cleanup
All checks were successful
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-centos9) (push) Successful in 16s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-debian11) (push) Successful in 13s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-debian12) (push) Successful in 13s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-fedora39) (push) Successful in 15s

This commit is contained in:
2024-02-16 00:49:19 -05:00
parent 3df16e6e47
commit f7c135d5d2
2 changed files with 2 additions and 11 deletions

View File

@ -5,20 +5,12 @@
gather_facts: true gather_facts: true
tasks: tasks:
- name: Debug bigboot_size
ansible.builtin.debug:
var: bigboot_size
- name: Capture boot device details - name: Capture boot device details
ansible.builtin.import_tasks: tasks/capture_boot_device_details.yml ansible.builtin.import_tasks: tasks/capture_boot_device_details.yml
- name: Shrink a logical volume for /boot expansion if needed - name: Shrink a logical volume for /boot expansion if needed
ansible.builtin.import_tasks: tasks/bigboot_manage_lv.yml 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 - name: Expand the /boot partition as requested
ansible.builtin.import_role: ansible.builtin.import_role:
name: infra.lvm_snapshots.bigboot name: infra.lvm_snapshots.bigboot

View File

@ -48,14 +48,14 @@
# Ex: # Ex:
# Free PE / Size 320 / 1.25 GiB" # Free PE / Size 320 / 1.25 GiB"
# Free PE / Size 189 / 756.00 MiB" # Free PE / Size 189 / 756.00 MiB"
# Free PE / Size 414 / <1.62 GiB
# Free PE / Size 0 / 0 # 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 - name: Get size only from the values
ansible.builtin.set_fact: ansible.builtin.set_fact:
bigboot_lv_size_in_mb: 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|\\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] }}" bigboot_size_in_mb: "{{ bigboot_size[:-1] }}"
- name: Check if we can shrink the logical volume - name: Check if we can shrink the logical volume
@ -65,7 +65,6 @@
that: that:
- bigboot_lv_vg_free_pe[:-4] != '' - bigboot_lv_vg_free_pe[:-4] != ''
- (bigboot_lv_size_in_mb[:-6] | int - bigboot_size_in_mb | int ) >= 0 - (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. fail_msg: Not enough free PE available for /boot expansion.
rescue: rescue: