Compare commits
48 Commits
5925357d90
...
develop
Author | SHA1 | Date | |
---|---|---|---|
6b3a346d2d | |||
66524c6bb2 | |||
fd809949f7 | |||
971cc1bdfe | |||
6e8726bddd | |||
5d18d161fe | |||
147c63ba89 | |||
5c3987bfa7 | |||
12f1c050cf | |||
943fb1b24f | |||
f39fea0f89 | |||
23c7547f32 | |||
78902c1371 | |||
8e057342da | |||
8106b95478 | |||
a3d5c17253 | |||
5cb1b9d68f | |||
9a9aa83adb | |||
53f3dbc6c8 | |||
50faad8c17 | |||
8b1e65188c | |||
68140fc346 | |||
d0caf12112 | |||
37d44db328 | |||
87a8235cc0 | |||
7abd1e74e2 | |||
716698202d | |||
e75578352f | |||
5e2ecd4f21 | |||
16eed5fec5 | |||
999ab17dfd | |||
a64abecc65 | |||
2d7764c183 | |||
9008c28110 | |||
efaf76ff23 | |||
ff5eeea88b | |||
2c9fcdef5a | |||
155c6e2631 | |||
07d169f527 | |||
a3021ac84e | |||
212ace2d6d | |||
a4a9c2fa89 | |||
2efe662c0e | |||
93d256af80 | |||
35531c86d7 | |||
51e313692d | |||
91a2423e2e | |||
0cc014824c |
@ -1,3 +1,3 @@
|
||||
export ANSIBLE_LINT_EXCLUSION="--exclude collections/ansible_collections --exclude .gitea"
|
||||
export ANSIBLE_INVENTORY="-i 127.0.0.1, --connection=local"
|
||||
export ANSIBLE_PLAYBOOK="bigboot-v2.yml"
|
||||
export ANSIBLE_PLAYBOOK="bigboot_setup_environment.yml"
|
@ -3,13 +3,13 @@ run-name: ${{ gitea.actor }} is running Ansible Code Pipeline
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
Ansible-Development-Pipeline:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ansible-dev-centos9, ansible-dev-fedora39, ansible-dev-debian11, ansible-dev-debian12 ]
|
||||
os: [ ansible-dev-fedora41 ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Clone repository
|
||||
@ -17,7 +17,7 @@ jobs:
|
||||
|
||||
- name: Ansible Environment Verify
|
||||
run: |
|
||||
. ./.drone.env
|
||||
. ./.ci.env
|
||||
env
|
||||
git log -1
|
||||
ansible --version
|
||||
@ -29,7 +29,7 @@ jobs:
|
||||
|
||||
- name: Run Ansible-Lint
|
||||
run: |
|
||||
. ./.drone.env
|
||||
. ./.ci.env
|
||||
ansible-lint --offline $ANSIBLE_LINT_EXCLUSION
|
||||
|
||||
# - name: Run Ansible-Playbook
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@ collections/ansible_collections/rhc*
|
||||
roles/autofsck
|
||||
roles/verified_reboot
|
||||
*.bak
|
||||
tasks/check_space_fallback_local.yml
|
||||
|
@ -14,6 +14,7 @@ timeout = 30
|
||||
host_key_checking = false
|
||||
display_skipped_hosts = false
|
||||
deprecation_warnings = false
|
||||
show_custom_stats = true
|
||||
|
||||
# callback_whitelist is deprecated
|
||||
# we only include here for backwards compatibility
|
||||
|
@ -1,27 +0,0 @@
|
||||
---
|
||||
- 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 }}"
|
@ -56,7 +56,7 @@
|
||||
ansible.builtin.import_role:
|
||||
name: infra.lvm_snapshots.bigboot
|
||||
vars:
|
||||
bigboot_partition_size: "{{ bigboot_size_target }}"
|
||||
bigboot_partition_size: "{{ bigboot_data[inventory_hostname]['bigboot_size_target'] }}"
|
||||
|
||||
- name: Failure on request
|
||||
ansible.builtin.fail:
|
||||
|
@ -13,30 +13,15 @@
|
||||
ansible.builtin.import_role:
|
||||
name: rhc.rear.rear_vars
|
||||
|
||||
- name: Debug rear_vars_nfs_share
|
||||
ansible.builtin.debug:
|
||||
var: rear_vars_nfs_share
|
||||
- name: Fetch the template name from NFS exports
|
||||
ansible.builtin.set_fact:
|
||||
job_template_name: "{{ nfs_exports_template_name }}"
|
||||
|
||||
# - name: Fetch the template name from NFS exports
|
||||
# ansible.builtin.set_fact:
|
||||
# job_template_name: "{{ nfs_exports_template_name }}"
|
||||
|
||||
# - name: Check for previous backup completion
|
||||
# ansible.builtin.stat:
|
||||
# path: "{{ rear_backup_success_file_path }}/{{ rear_backup_workflow }}_rear_success"
|
||||
# register: rear_backup_success_file
|
||||
|
||||
# - name: End if backup has already completed successfully
|
||||
# ansible.builtin.meta: end_host
|
||||
# when:
|
||||
# - rear_backup_success_file['stat']['exists'] | bool
|
||||
# - not rear_force_backup | default(false) | bool
|
||||
|
||||
# - name: Perform ReaR Backup
|
||||
# when:
|
||||
# - bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool
|
||||
# - not rear_backup_skip | default(false) | bool
|
||||
# block:
|
||||
# - name: Perform ReaR backup
|
||||
# ansible.builtin.include_role:
|
||||
# name: rhc.rear.rear_backup
|
||||
- name: Perform ReaR Backup
|
||||
when:
|
||||
- bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool
|
||||
- not rear_backup_skip | default(false) | bool
|
||||
block:
|
||||
- name: Perform ReaR backup
|
||||
ansible.builtin.include_role:
|
||||
name: rhc.rear.rear_backup
|
||||
|
@ -24,12 +24,16 @@
|
||||
- name: Update NFS exports on reachable servers
|
||||
hosts: reachable_hosts
|
||||
become: true
|
||||
gather_facts: false
|
||||
gather_facts: true
|
||||
|
||||
vars_files:
|
||||
- bigboot_vars.yml
|
||||
|
||||
tasks:
|
||||
- name: Import rear_vars role
|
||||
ansible.builtin.import_role:
|
||||
name: rhc.rear.rear_vars
|
||||
|
||||
- name: Grab the template name
|
||||
ansible.builtin.set_stats:
|
||||
aggregate: false
|
||||
@ -45,4 +49,3 @@
|
||||
when:
|
||||
- item['value']['bigboot_execute_bigboot'] | default(false) | bool
|
||||
- not rear_backup_skip | default(false) | bool
|
||||
|
||||
|
@ -9,6 +9,10 @@
|
||||
- bigboot_vars.yml
|
||||
|
||||
tasks:
|
||||
- name: Import rear_vars role
|
||||
ansible.builtin.import_role:
|
||||
name: rhc.rear.rear_vars
|
||||
|
||||
- name: Restore from ReaR backup
|
||||
ansible.builtin.include_role:
|
||||
name: rhc.rear.rear_restore
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
- name: Set logical volume information
|
||||
ansible.builtin.import_tasks: tasks/capture_lv_device_details.yml
|
||||
when:
|
||||
- bigboot_execute_bigboot | default(false) | bool
|
||||
|
||||
- name: Set environment for subsequent workflow nodes
|
||||
ansible.builtin.set_stats:
|
||||
@ -26,10 +28,11 @@
|
||||
combine({inventory_hostname:
|
||||
{
|
||||
'bigboot_execute_bigboot': bigboot_execute_bigboot,
|
||||
'bigboot_execute_shrink_lv': bigboot_execute_shrink_lv,
|
||||
'bigboot_adjacent_lvm_device': bigboot_adjacent_lvm_device,
|
||||
'bigboot_lv_shrink_size': bigboot_lv_shrink_size | int,
|
||||
'bigboot_pv': bigboot_pv,
|
||||
'bigboot_execute_shrink_lv': bigboot_execute_shrink_lv | default(false),
|
||||
'bigboot_adjacent_lvm_device': bigboot_adjacent_lvm_device | default(omit),
|
||||
'bigboot_lv_shrink_size': bigboot_lv_shrink_size | default(0) | int,
|
||||
'bigboot_pv': bigboot_pv | default(omit),
|
||||
'bigboot_size_target': bigboot_size_target_fallback | default(bigboot_size_target),
|
||||
'ip_addresses': ansible_all_ipv4_addresses,
|
||||
'server_hostname': ansible_hostname
|
||||
}
|
||||
|
66
filter_plugins/fallback_space_check.py
Executable file
66
filter_plugins/fallback_space_check.py
Executable file
@ -0,0 +1,66 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
# bigboot_size: "{{ bigboot_size_expansion_mb[:-2] | int | get_block_size_up }}"
|
||||
|
||||
class FilterModule (object):
|
||||
def filters (self):
|
||||
return {
|
||||
'bigboot_fallback_size': self.bigboot_fallback_size,
|
||||
'moo': self.moo,
|
||||
}
|
||||
|
||||
def bigboot_fallback_size(self, fallback_size):
|
||||
return ('{}{}'.format(fallback_size, 'M'))
|
||||
|
||||
def moo(self, a_variable):
|
||||
a_new_variable = (str(a_variable) + '~~~~MOOOOOOOOOOOOOOOOOOOOOOOOO! => ' + '%s' % type(a_variable))
|
||||
return a_new_variable
|
||||
|
||||
|
||||
|
||||
# import shutil
|
||||
# import os
|
||||
|
||||
# def check_mount_space(mount_path, min_space_gb=1):
|
||||
# try:
|
||||
# # Get disk usage statistics for the mount point
|
||||
# disk_usage = shutil.disk_usage(mount_path)
|
||||
|
||||
# # Convert bytes to gigabytes
|
||||
# free_space_gb = disk_usage.free / (1024 ** 3)
|
||||
|
||||
# print(f"Mount point: {mount_path}")
|
||||
# print(f"Free space: {free_space_gb:.2f} GB")
|
||||
|
||||
# if free_space_gb > min_space_gb:
|
||||
# print("✓ More than 1GB available")
|
||||
# return True
|
||||
# else:
|
||||
# print("✗ Less than 1GB available")
|
||||
# return False
|
||||
|
||||
# except Exception as e:
|
||||
# print(f"Error checking {mount_path}: {str(e)}")
|
||||
# return False
|
||||
|
||||
# def check_all_mounts():
|
||||
# # Read mount points from /proc/mounts
|
||||
# with open('/proc/mounts', 'r') as f:
|
||||
# mounts = f.readlines()
|
||||
|
||||
# results = []
|
||||
# for mount in mounts:
|
||||
# # Split the mount line and get the mount point (second field)
|
||||
# mount_point = mount.split()[1]
|
||||
|
||||
# # Skip some virtual filesystems
|
||||
# if mount_point.startswith(('/proc', '/sys', '/dev', '/run')):
|
||||
# continue
|
||||
|
||||
# results.append(check_mount_space(mount_point))
|
||||
|
||||
# return results
|
||||
|
||||
# if __name__ == "__main__":
|
||||
# print("Checking mount points for available space...")
|
||||
# check_all_mounts()
|
@ -7,7 +7,9 @@ class FilterModule (object):
|
||||
return {
|
||||
'get_block_size_up': self.get_block_size_up,
|
||||
'get_block_size_down': self.get_block_size_down,
|
||||
'moo': self.moo,
|
||||
'get_block_size_up_bytes': self.get_block_size_up_bytes,
|
||||
'get_block_size_down_bytes': self.get_block_size_down_bytes,
|
||||
'moo': self.moo
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +23,16 @@ class FilterModule (object):
|
||||
start_size -= 1
|
||||
return ('{}{}'.format(start_size, 'M'))
|
||||
|
||||
def get_block_size_up_bytes(self, start_size):
|
||||
while start_size % BLOCK_SIZE != 0:
|
||||
start_size += 1
|
||||
return ('{}'.format(start_size))
|
||||
|
||||
def get_block_size_down_bytes(self, start_size):
|
||||
while start_size % BLOCK_SIZE != 0:
|
||||
start_size -= 1
|
||||
return ('{}'.format(start_size))
|
||||
|
||||
def moo(self, a_variable):
|
||||
a_new_variable = (str(a_variable) + '~~~~MOOOOOOOOOOOOOOOOOOOOOOOOO! => ' + '%s' % type(a_variable))
|
||||
return a_new_variable
|
||||
|
@ -1,10 +1,14 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# pvsqueeze - Squeeze PEs into free holes
|
||||
# pvsqueeze - Squeeze linear extents into free holes
|
||||
#
|
||||
# This script iteratively moves linear (allocated to LV) PEs to fill in free
|
||||
# holes found in a PV segement map. The end result is that all free PEs are
|
||||
# at the end of the PV. Use this script as required in anger!
|
||||
# This script iteratively moves linear (allocated to LV) extents to fill in
|
||||
# free holes found in a PV segment map. The end result is that all free
|
||||
# extents are at the end of the PV. Use this script in anger as required!
|
||||
#
|
||||
# The script outputs the PV segment map before moving anything, then iterates
|
||||
# stuffing extents in each free hole until there are no more except for the
|
||||
# last one, and finally outputs the PV segment map again showing the changes.
|
||||
#
|
||||
|
||||
# Usage
|
||||
@ -51,6 +55,7 @@ while true; do
|
||||
[[ $free_start -gt $move_start ]] && break
|
||||
|
||||
# Move last linear PEs to the free segment
|
||||
[[ $free_size -gt $move_size ]] && free_size=$move_size
|
||||
from_range="$pvdev:$((move_start+move_size-free_size))-$((move_start+move_size-1))"
|
||||
to_range="$pvdev:$((free_start))-$((free_start+free_size))"
|
||||
echo "Moving $from_range to $to_range..."
|
||||
|
@ -21,14 +21,6 @@
|
||||
bigboot_expansion_diff:
|
||||
"{{ bigboot_size_target | human_to_bytes - bigboot_boot_partsize | human_to_bytes }}"
|
||||
|
||||
- name: Convert size difference to MB
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_size_expansion_mb: "{{ bigboot_expansion_diff | int | human_readable(unit='M') }}"
|
||||
|
||||
- name: Set bigboot size 4k aligned
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_size: "{{ bigboot_size_expansion_mb[:-2] | int | get_block_size_up }}"
|
||||
|
||||
- name: Validate if we need to expand boot
|
||||
block:
|
||||
- name: Set flag for Bigboot execution
|
||||
@ -42,10 +34,25 @@
|
||||
success_msg: The /boot partition is already at the desired size
|
||||
|
||||
rescue:
|
||||
- name: Set flag for Bigboot execution
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_execute_bigboot: true
|
||||
- name: "Check if /boot is already at or above {{ bigboot_size_min }}"
|
||||
block:
|
||||
- name: "Assert that /boot is already at or above {{ bigboot_size_min }}"
|
||||
ansible.builtin.assert:
|
||||
that: bigboot_boot_partsize | human_to_bytes >= bigboot_size_min | human_to_bytes
|
||||
success_msg: >
|
||||
/boot partition size is already at least {{ bigboot_size_min }}
|
||||
or greater. Nothing to do.
|
||||
fail_msg: >
|
||||
/boot partition size is less than {{ bigboot_size_min }}.
|
||||
Expansion of /boot is required.
|
||||
|
||||
- name: Expansion of /boot required
|
||||
ansible.builtin.debug:
|
||||
msg: "Will need to expand /boot by an additional {{ bigboot_size }}."
|
||||
rescue:
|
||||
- name: Set flag for Bigboot execution
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_execute_bigboot: true
|
||||
|
||||
- name: Expansion of /boot required
|
||||
ansible.builtin.debug:
|
||||
msg: >
|
||||
Will attempt to increase to {{ bigboot_size_target }},
|
||||
or {{ bigboot_size_min }} at the minimum.
|
||||
|
@ -42,14 +42,36 @@
|
||||
bigboot_lv_info: "{{ ansible_facts.mounts \
|
||||
| selectattr('device', 'equalto', bigboot_adjacent_lvm_device) | first }}"
|
||||
|
||||
- name: Assert that there is space on the logical volume for shrinkage
|
||||
ansible.builtin.assert:
|
||||
that: bigboot_lv_info.size_available > bigboot_expansion_diff | int
|
||||
fail_msg: There is not enough space available for LV shrinking.
|
||||
# - name: Assert that there is space on the logical volume for shrinkage
|
||||
# ansible.builtin.assert:
|
||||
# that: bigboot_lv_info.size_available > bigboot_expansion_diff | int
|
||||
# fail_msg: There is not enough space available for LV shrinking.
|
||||
|
||||
- name: Capture shrink size for logical volume
|
||||
- name: Capture UUID for target volume
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_lv_shrink_size: "{{ bigboot_lv_info.size_total - bigboot_expansion_diff | int }}"
|
||||
bigboot_lv_uuid: "{{ ansible_facts['mounts'] | selectattr('device', 'equalto', bigboot_adjacent_lvm_device) | map(attribute='uuid') | first }}"
|
||||
|
||||
- name: Capture block device information for target logical volume
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_lv_dm: "{{ ansible_device_links['uuids'] | dict2items | selectattr('value', 'contains', bigboot_lv_uuid) | map(attribute='key') | first }}"
|
||||
|
||||
- name: Set initial sizes for logical volume and fallback size target
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_lv_partsize: "{{ ansible_devices[bigboot_lv_dm]['sectors'] | int * ansible_devices[bigboot_lv_dm]['sectorsize'] | int }}"
|
||||
bigboot_size_target_fallback: "{{ bigboot_size_target | human_to_bytes }}"
|
||||
|
||||
- name: Check available space and fallback to lower /boot size if required
|
||||
ansible.builtin.include_tasks: check_space_fallback.yml
|
||||
|
||||
- name: Capture shrink and fallback sizes
|
||||
ansible.builtin.set_fact:
|
||||
# we need to get the BLOCK size total, not the filesystem
|
||||
bigboot_lv_shrink_size: "{{ bigboot_lv_partsize | int - bigboot_expansion_diff | int }}"
|
||||
bigboot_size_target_fallback: "{{ bigboot_size_target_fallback | int | human_readable(unit='G') | regex_replace('\\sGB', 'G') }}"
|
||||
|
||||
- name: Debug bigboot_lv_shrink_size and bigboot_size_target_fallback
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ bigboot_lv_shrink_size | int | human_readable(unit='G') }} ({{ bigboot_lv_shrink_size | int | human_readable(unit='M') | regex_replace('\\.\\d+\\s+MB') | int | get_block_size_down }}) <-> {{ bigboot_size_target_fallback }} | {{ bigboot_expansion_diff }}"
|
||||
|
||||
- name: Capture logical volume name
|
||||
ansible.builtin.shell:
|
||||
@ -62,7 +84,7 @@
|
||||
|
||||
- name: Format logical volume name
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_lv_vg_name: "{{ bigboot_lv_vg_name.stdout | regex_replace('VG\\s+Name\\s+(.*)$', '\\1') }}"
|
||||
bigboot_lv_vg_name: "{{ bigboot_lv_vg_name['stdout'] | regex_replace('VG\\s+Name\\s+(.*)$', '\\1') }}"
|
||||
|
||||
- name: Capture volume group free PE
|
||||
ansible.builtin.shell:
|
||||
@ -73,6 +95,23 @@
|
||||
changed_when: false
|
||||
register: bigboot_lv_vg_free_pe
|
||||
|
||||
- name: Capture volume group PE size
|
||||
ansible.builtin.shell:
|
||||
cmd: |
|
||||
set -o pipefail
|
||||
vgdisplay {{ bigboot_lv_vg_name | trim }} | grep -i 'pe size'
|
||||
executable: /bin/bash
|
||||
changed_when: false
|
||||
register: bigboot_lv_vg_pe_capture
|
||||
|
||||
- name: Set PE size
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_lv_vg_pe_size: "{{ bigboot_lv_vg_pe_capture | regex_replace('^.*\\s+(\\d+.\\d+).*$', '\\1M') | human_to_bytes }}"
|
||||
|
||||
- name: Subtract an additional 2 PE for shrinking
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_lv_shrink_size: "{{ bigboot_lv_shrink_size | int - (bigboot_lv_vg_pe_size | int * 2) }}"
|
||||
|
||||
- name: Capture the PV device
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_pv: "{{ bigboot_boot_mount['device'][:-1] }}{{ bigboot_boot_mount['device'][-1:] | int + 1 }}"
|
||||
@ -84,22 +123,23 @@
|
||||
# Free PE / Size 189 / 756.00 MiB"
|
||||
# Free PE / Size 414 / <1.62 GiB
|
||||
# Free PE / Size 0 / 0
|
||||
bigboot_lv_vg_free_pe: "{{ bigboot_lv_vg_free_pe.stdout | regex_replace('^.*/.*/\\s+[<]?(.*)', '\\1') }}"
|
||||
bigboot_lv_vg_free_pe: "{{ bigboot_lv_vg_free_pe['stdout'] | regex_replace('^.*/.*/\\s+[<]?(.*)', '\\1') }}"
|
||||
|
||||
- name: Get size in MB for PE and
|
||||
- name: Get size in MB for available PE
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_lv_pe_size_in_mb:
|
||||
"{{ bigboot_lv_vg_free_pe | regex_replace('i|\\s+|<', '') | human_to_bytes | human_readable(unit='M') }}"
|
||||
|
||||
- name: Verify available PE for the volume group
|
||||
block:
|
||||
- name: Set flag for Shrink_LV execution
|
||||
- name: Set variables required for shrinking the target LV
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_execute_shrink_lv: false
|
||||
bigboot_expansion_diff_mb: "{{ bigboot_expansion_diff | int | human_readable(unit='M') }}"
|
||||
|
||||
- name: Assert if we need to execute the shrink_lv role to gain free PE
|
||||
- name: Assert if we need to shrink the logical volume to gain PE
|
||||
ansible.builtin.assert:
|
||||
that: (bigboot_lv_pe_size_in_mb[:-3] | int | round) | int > bigboot_size[:-1] | int
|
||||
that: (bigboot_lv_pe_size_in_mb[:-3] | int) >= (bigboot_expansion_diff_mb[:-3] | int)
|
||||
fail_msg: Not enough PE to expand /boot.
|
||||
|
||||
rescue:
|
||||
|
37
tasks/check_space_fallback.yml
Normal file
37
tasks/check_space_fallback.yml
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
- name: Debug bigboot_expansion_diff
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ bigboot_expansion_diff }} + {{ bigboot_size_target_fallback }} <-> {{ bigboot_boot_partsize }}"
|
||||
|
||||
- name: Fail if /boot can't expand to at least 1GB
|
||||
ansible.builtin.assert:
|
||||
that: bigboot_size_target_fallback | int >= bigboot_size_min | human_to_bytes
|
||||
fail_msg:
|
||||
"{{ bigboot_size_target_fallback | int | human_readable(unit='M') }} is less than the minimum required size of {{ bigboot_size_min }}."
|
||||
|
||||
- name: Verify available space and re-check if needed
|
||||
block:
|
||||
- name: Assert that there is space on the logical volume for shrinkage
|
||||
ansible.builtin.assert:
|
||||
that: bigboot_lv_info['size_available'] > bigboot_expansion_diff | int
|
||||
fail_msg: There is not enough free space available to shrink the filesystem
|
||||
|
||||
- name: Assert that there will be enough space left over on the target LV
|
||||
ansible.builtin.assert:
|
||||
that: (bigboot_lv_info['size_available'] - bigboot_expansion_diff | int) >= bigboot_lv_size_min | human_to_bytes
|
||||
# success_msg: "There will be enough space left over with a boot size of {{ bigboot_size_target_fallback | int | human_readable(unit='G') }}. ({{ (bigboot_lv_info['size_total'] - bigboot_expansion_diff | int) | human_readable(unit='B') }})"
|
||||
fail_msg: "There will NOT be enough space left over with a boot size of {{ bigboot_size_target_fallback | int | human_readable(unit='G') }}."
|
||||
|
||||
rescue:
|
||||
- name: "Decrement size target by {{ bigboot_size_decrement }}"
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_size_target_fallback:
|
||||
"{{ bigboot_size_target_fallback | int - bigboot_size_decrement | human_to_bytes }}"
|
||||
|
||||
- name: Update required expansion space
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_expansion_diff:
|
||||
"{{ (bigboot_size_target_fallback | int - bigboot_boot_partsize | human_to_bytes) }}"
|
||||
|
||||
- name: Re-check disk space - RESCUE
|
||||
ansible.builtin.include_tasks: check_space_fallback.yml
|
@ -4,9 +4,6 @@
|
||||
client_ips: "{{ item['value']['ip_addresses'] | list | flatten }}"
|
||||
namehost: "{{ item['value']['server_hostname'] }}"
|
||||
|
||||
- name: Include NFS export role # noqa var-naming
|
||||
- name: Include NFS export role
|
||||
ansible.builtin.include_role:
|
||||
name: rhc.rear.nfs_export
|
||||
vars:
|
||||
rear_nfs_export_share: "{{ bigboot_nfs_backup_share }}"
|
||||
rear_nfs_export_fsid: "{{ bigboot_nfs_backup_share_fsid }}"
|
||||
|
@ -1,7 +1,10 @@
|
||||
---
|
||||
ansible_ssh_retries: 10
|
||||
|
||||
bigboot_size_target: 1G
|
||||
bigboot_size_target: 2G
|
||||
bigboot_size_min: 1G
|
||||
bigboot_size_decrement: 250M
|
||||
bigboot_lv_size_min: 1G
|
||||
|
||||
# Filename of disabled services log:
|
||||
bigboot_disabled_services_log: /var/IPE/IPU/el7to8/bigboot_disabled_services.log
|
||||
|
Reference in New Issue
Block a user