add fix for logical volume selection and a couple of typo fixes

This commit is contained in:
Chris Hammer 2024-06-14 17:52:49 -04:00
parent 23ced84443
commit fe354b45bc
3 changed files with 21 additions and 7 deletions

View File

@ -30,7 +30,7 @@
strategy: free
tasks:
- name: Expand the logical volume to support /boot expansion
- name: Shrink the logical volume to support /boot expansion
ansible.builtin.debug:
msg:
- "device: {{ bigboot_adjacent_lvm_device }}"

View File

@ -13,7 +13,7 @@
when:
- "'host' in ansible_virtualization_role"
- name: Expand the logical volume to support /boot expansion
- name: Shrink the logical volume to support /boot expansion
ansible.builtin.import_role:
name: infra.lvm_snapshots.shrink_lv
vars:

View File

@ -1,18 +1,32 @@
---
- name: Capture logical volume adjacent to /boot
- name: Capture all logical volume paritions on /boot device
ansible.builtin.shell:
cmd: |
set -o pipefail
lsblk -pl -o name,type,mountpoint {{ bigboot_boot_mount['device'][:-1] }} \
| grep -vi swap | grep lvm | head -1 | awk '{ print $1}'
lsblk -pl -o name,type {{ bigboot_boot_mount['device'][:-1] }} | grep -i lvm
executable: /bin/bash
changed_when: false
failed_when: bigboot_adjacent_lvm['rc'] not in [0, 141]
register: bigboot_adjacent_lvm
failed_when: bigboot_adjacent_lvm['rc'] not in [0,141]
- name: Map the device to its mount point if applicable
ansible.builtin.set_fact:
bigboot_adjacent_lvm_devices: "{{ bigboot_adjacent_lvm_devices | default([]) | combine({item | split(' ') | first: ansible_facts['mounts'] | selectattr('device', 'equalto', item | split(' ') | first) | map(attribute='mount')}) }}"
loop: "{{ bigboot_adjacent_lvm['stdout_lines'] }}"
- name: Capture the device name of the mounted logical volumes
ansible.builtin.set_fact:
bigboot_lvm_mounts: "{{ bigboot_lvm_mounts | default([]) + [item['key']] }}"
loop: "{{ bigboot_adjacent_lvm_devices | dict2items }}"
when: item['value'] | regex_search("[a-zA-Z]")
- name: Set adjacent LVM device name
ansible.builtin.set_fact:
bigboot_adjacent_lvm_device: "{{ bigboot_adjacent_lvm.stdout }}"
bigboot_adjacent_lvm_device: "{{ bigboot_lvm_mounts | first }}"
- name: Debug bigboot_adjacent_lvm_device
ansible.builtin.debug:
var: bigboot_adjacent_lvm_device
- name: Get logical volume mount information
ansible.builtin.set_fact: