shrink_lv/tasks/pre-checks.yml

30 lines
1.1 KiB
YAML

---
- name: Get /boot mount information
ansible.builtin.set_fact:
bigboot_boot_mount: "{{ ansible_facts.mounts \
| selectattr('mount', 'equalto', '/boot') | first }}"
- name: Set next partition after /boot
ansible.builtin.set_fact:
bigboot_next_device: "{{ bigboot_boot_mount['device'][:-1] }}{{ bigboot_boot_mount['device'][-1:] | int + 1 }}"
- name: Capture partition information from fdisk
ansible.builtin.shell:
cmd: |
set -o pipefail
fdisk -l {{ bigboot_boot_mount['device'][:-1] }} | grep '{{ bigboot_next_device }}'
executable: /bin/bash
changed_when: false
failed_when: bigboot_fdisk_partition['rc'] not in [0, 141]
register: bigboot_fdisk_partition
- name: Debug bigboot_fdisk_partition
ansible.builtin.debug:
var: bigboot_fdisk_partition
- name: Assert that the partition following /boot is of type LVM
ansible.builtin.assert:
that: "'Linux LVM' in bigboot_fdisk_partition['stdout']"
success_msg: The partition following /boot is an LVM partition
fail_msg: The partition following /boot is NOT an LVM partition. Execution halted.