50 lines
2.0 KiB
YAML
50 lines
2.0 KiB
YAML
---
|
|
- name: Shrink logical volumes
|
|
hosts: bigboot
|
|
become: false
|
|
gather_facts: true
|
|
|
|
|
|
tasks:
|
|
- name: Get mounts
|
|
ansible.builtin.debug:
|
|
var: ansible_facts.mounts
|
|
|
|
- name: Find the boot mount entry
|
|
ansible.builtin.set_fact:
|
|
bigboot_boot_mount_entry: "{{ ansible_facts.mounts | selectattr('mount', 'equalto', '/boot') | first }}"
|
|
|
|
- name: Calculate the partition to look for
|
|
ansible.builtin.set_fact:
|
|
bigboot_boot_partition_name: "{{ (bigboot_boot_mount_entry.device | split('/'))[-1] }}"
|
|
|
|
- name: Find the boot device parent
|
|
ansible.builtin.set_fact:
|
|
bigboot_boot_disk: "{{ item.key }}"
|
|
with_dict: "{{ ansible_facts.devices }}"
|
|
when: bigboot_boot_partition_name in item.value.partitions
|
|
|
|
- name: Capture boot device details
|
|
ansible.builtin.set_fact:
|
|
bigboot_boot_device_partition_prefix: "{{ bigboot_boot_partition_name[(bigboot_boot_disk | length) : -1] }}"
|
|
bigboot_boot_partition_number: "{{ bigboot_boot_partition_name[-1] }}"
|
|
bigboot_boot_device_name: "/dev/{{ bigboot_boot_disk }}"
|
|
bigboot_boot_device_original_size: "{{ bigboot_boot_mount_entry.size_total | int }}"
|
|
|
|
- name: Debug bigboot_boot_* vars
|
|
ansible.builtin.debug:
|
|
msg: "{{ item }}"
|
|
loop:
|
|
- "bigboot_boot_mount_entry => {{ bigboot_boot_mount_entry }}"
|
|
- "bigboot_boot_partition_name => {{ bigboot_boot_partition_name }}"
|
|
- "bigboot_boot_disk => {{ bigboot_boot_disk }}"
|
|
- "bigboot_boot_device_partition_prefix => {{ bigboot_boot_device_partition_prefix }}"
|
|
- "bigboot_boot_partition_number => {{ bigboot_boot_partition_number }}"
|
|
- "bigboot_boot_device_name => {{ bigboot_boot_device_name }}"
|
|
- "bigboot_boot_device_original_size => {{ bigboot_boot_device_original_size }}"
|
|
|
|
|
|
- name: Debug __my_tower_var
|
|
ansible.builtin.debug:
|
|
msg: "{{ __my_tower_var | default('it didnt work') }}"
|