clean up
All checks were successful
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-centos9) (push) Successful in 13s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-debian11) (push) Successful in 13s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-debian12) (push) Successful in 13s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-fedora39) (push) Successful in 16s

This commit is contained in:
Chris Hammer 2024-02-12 00:14:21 -05:00
parent e5a9eea889
commit 7b991306dd
8 changed files with 1 additions and 223 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
inventory/* inventory/*
*.bak *.bak
test*.yml test*.yml
misc

View File

@ -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

16
echo.sh
View File

@ -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)"

View File

@ -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

View File

@ -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

View File

@ -1 +0,0 @@
grubby --remove-args="rhgb quiet" --update-kernel=`grubby --default-kernel`

View File

@ -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 }}"
...

View File

@ -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') }}"