---
- name: Perform logical volume and boot parition resizing as needed
  hosts: all
  become: true
  gather_facts: true
  strategy: free

  vars_files:
    - bigboot_vars.yml

  tasks:
    - name: Cleanup from any previous executions
      ansible.builtin.import_tasks: tasks/cleanup.yml

    - name: Shrink the logical volume to support /boot expansion
      ansible.builtin.import_role:
        name: infra.lvm_snapshots.shrink_lv
      vars:
        shrink_lv_devices:
          - device: "/dev/mapper/system-root"
            size: "53687091200"

    - name: Expand the /boot partition as requested
      ansible.builtin.import_role:
        name: infra.lvm_snapshots.bigboot
      vars:
        bigboot_partition_size: "{{ bigboot_size_target }}"
