diff --git a/.gitignore b/.gitignore index d3988c4..9bda8fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ inventory/* *.bak test*.yml +misc diff --git a/check-device.yml b/check-device.yml deleted file mode 100644 index 5e22978..0000000 --- a/check-device.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: Get Mounts - hosts: all - become: true - gather_facts: false - - - vars: - # bigboot_boot_device_partition_prefix: "{{ bigboot_boot_partition_name[(bigboot_boot_disk | length) : -1] }}" - bigboot_device: "/dev/sda1" - bigboot_prefix: "{{ (bigboot_device | length) : -1 }}" - - - tasks: - - name: Debug bigboot_prefix - ansible.builtin.debug: - var: bigboot_prefix diff --git a/echo.sh b/echo.sh deleted file mode 100755 index ab2b6bc..0000000 --- a/echo.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - - -start=$(/usr/bin/date +%s) - -sleep 3 - -end=$(/usr/bin/date +%s) - - -echo "${end}-${start}" -echo "$(expr $end - $start)" -echo "$((end-start))" - - -echo "Failed to extend boot partition: ($((end-start)) seconds)" diff --git a/get_mounts.yml b/get_mounts.yml deleted file mode 100644 index afc62bf..0000000 --- a/get_mounts.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- -- name: Get Mounts - hosts: all - become: true - gather_facts: false - - - vars: - shrink_lv_devices: - - device: /dev/mapper/test--vg01-test--lv01 - size: 40G - - - device: /dev/mapper/test--vg02-test--lv02 - size: 40G - - - tasks: - - name: Retrieve mount points - ansible.builtin.setup: - gather_subset: - - "!all" - - "!min" - - mounts - - - name: Capture LVM device details - ansible.builtin.set_fact: - shrink_lv_mount_info: "{{ shrink_lv_mount_info | default([]) + \ - [ansible_facts.mounts | selectattr('device', 'equalto', item.device)] }}" - loop: "{{ shrink_lv_devices }}" - loop_control: - label: "{{ item.device }}" - - - name: Debug shrink_lv_mount_info - ansible.builtin.debug: - var: shrink_lv_mount_info diff --git a/reboot.yml b/reboot.yml deleted file mode 100644 index 30bfe32..0000000 --- a/reboot.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -- name: Shrink logical volumes - hosts: shrink_lv - become: false - gather_facts: true - - - tasks: - - name: Issue reboot command - ansible.builtin.command: /sbin/shutdown -r +1 - - - name: Wait for the reboot to complete - ansible.builtin.wait_for_connection: - connect_timeout: 20 - sleep: 10 - delay: 70 - timeout: "{{ pre_ipu_reboot_timeout | default('1800') }}" - - - name: Find the boot mount entry - ansible.builtin.set_fact: - bigboot_boot_mount_entry: "{{ ansible_facts.mounts | selectattr('mount', 'match', '/boot') | first }}" - - - name: Debug bigboot_boot_mount_entry - ansible.builtin.debug: - var: bigboot_boot_mount_entry diff --git a/remove_args.sh b/remove_args.sh deleted file mode 100644 index 0d4bf84..0000000 --- a/remove_args.sh +++ /dev/null @@ -1 +0,0 @@ -grubby --remove-args="rhgb quiet" --update-kernel=`grubby --default-kernel` diff --git a/test.yml b/test.yml deleted file mode 100644 index 355f87e..0000000 --- a/test.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -- 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', 'match', '/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: Calculate the partition to look for - ansible.builtin.set_fact: - bigboot_boot_partition_name: "{{ bigboot_boot_mount_entry.device | ansible.builtin.regex_replace('.*/(.*$)', '\\1') }}" - - # - name: Capture boot device new size - # ansible.builtin.set_fact: - # bigboot_boot_device_new_size_orig: "{{ (ansible_facts.mounts | selectattr('mount', 'equalto', '/boot') | first).size_total | int }}" - - - name: Capture boot device new size - ansible.builtin.set_fact: - bigboot_boot_device_new_size: "{{ (ansible_facts.mounts | selectattr('mount', 'match', '/boot') | first).size_total | int }}" - - - name: Get default kernel - ansible.builtin.command: - cmd: /sbin/grubby --default-kernel - register: initramfs_grubby_rc - changed_when: false - - - name: Parse default kernel version - ansible.builtin.set_fact: - # split was introduced in 2.11 - # initramfs_default_kernel_orig: "{{ ((((initramfs_grubby_rc.stdout_lines[0] | split('/'))[2] | split('-'))[1:]) | join('-')) | trim }}" - initramfs_default_kernel_pre: "{{ initramfs_grubby_rc.stdout }}" - - # fixes compatibility to run on: - # Ansible 2.9.27 -> 2.16.2 - initramfs_default_kernel: "{{ initramfs_grubby_rc.stdout | ansible.builtin.regex_replace('^.*?-(.*$)', '\\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 | default() | ansible.builtin.regex_replace('^.+([0-9]{1})$', '\\1') }}" - when: "'nvme' not in bigboot_boot_disk" - - - name: Capture boot device details (NVMe) - ansible.builtin.set_fact: - bigboot_boot_device_partition_prefix: "{{ bigboot_boot_partition_name | default() | ansible.builtin.regex_replace('^.+([a-z0-9]{2})$', '\\1') }}" - when: "'nvme' in bigboot_boot_disk" - - - name: Debug stuffs - ansible.builtin.debug: - var: item - loop: - # - "{{ initramfs_grubby_rc }}" - # - "{{ initramfs_default_kernel_pre }}" - # - "{{ initramfs_default_kernel }}" - # - "{{ ansible_facts.kernel }}" - - "bigboot_boot_partition_name == {{ bigboot_boot_partition_name }}" - - "bigboot_boot_device_new_size == {{ bigboot_boot_device_new_size }}" - - "bigboot_boot_disk == {{ bigboot_boot_disk }}" - - "bigboot_boot_device_partition_prefix == {{ bigboot_boot_device_partition_prefix }}" - -... diff --git a/test2.yml b/test2.yml deleted file mode 100644 index e203168..0000000 --- a/test2.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -- 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') }}"