Updates to allow Bigboot to decrement from the default target size, down to a minimum threshold of 1GB
This commit is contained in:
parent
212ace2d6d
commit
a3021ac84e
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@ collections/ansible_collections/rhc*
|
|||||||
roles/autofsck
|
roles/autofsck
|
||||||
roles/verified_reboot
|
roles/verified_reboot
|
||||||
*.bak
|
*.bak
|
||||||
|
tasks/check_space_fallback_local.yml
|
||||||
|
@ -14,6 +14,7 @@ timeout = 30
|
|||||||
host_key_checking = false
|
host_key_checking = false
|
||||||
display_skipped_hosts = false
|
display_skipped_hosts = false
|
||||||
deprecation_warnings = false
|
deprecation_warnings = false
|
||||||
|
show_custom_stats = true
|
||||||
|
|
||||||
# callback_whitelist is deprecated
|
# callback_whitelist is deprecated
|
||||||
# we only include here for backwards compatibility
|
# 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:
|
ansible.builtin.import_role:
|
||||||
name: infra.lvm_snapshots.bigboot
|
name: infra.lvm_snapshots.bigboot
|
||||||
vars:
|
vars:
|
||||||
bigboot_partition_size: "{{ bigboot_size_target }}"
|
bigboot_partition_size: "{{ bigboot_data[inventory_hostname]['bigboot_size_target'] }}"
|
||||||
|
|
||||||
- name: Failure on request
|
- name: Failure on request
|
||||||
ansible.builtin.fail:
|
ansible.builtin.fail:
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
'bigboot_adjacent_lvm_device': bigboot_adjacent_lvm_device,
|
'bigboot_adjacent_lvm_device': bigboot_adjacent_lvm_device,
|
||||||
'bigboot_lv_shrink_size': bigboot_lv_shrink_size | int,
|
'bigboot_lv_shrink_size': bigboot_lv_shrink_size | int,
|
||||||
'bigboot_pv': bigboot_pv,
|
'bigboot_pv': bigboot_pv,
|
||||||
|
'bigboot_size_target': bigboot_size_target | int,
|
||||||
'ip_addresses': ansible_all_ipv4_addresses,
|
'ip_addresses': ansible_all_ipv4_addresses,
|
||||||
'server_hostname': ansible_hostname
|
'server_hostname': ansible_hostname
|
||||||
}
|
}
|
||||||
|
@ -42,15 +42,25 @@
|
|||||||
bigboot_lv_info: "{{ ansible_facts.mounts \
|
bigboot_lv_info: "{{ ansible_facts.mounts \
|
||||||
| selectattr('device', 'equalto', bigboot_adjacent_lvm_device) | first }}"
|
| selectattr('device', 'equalto', bigboot_adjacent_lvm_device) | first }}"
|
||||||
|
|
||||||
- name: Assert that there is space on the logical volume for shrinkage
|
# - name: Assert that there is space on the logical volume for shrinkage
|
||||||
ansible.builtin.assert:
|
# ansible.builtin.assert:
|
||||||
that: bigboot_lv_info.size_available > bigboot_expansion_diff | int
|
# that: bigboot_lv_info.size_available > bigboot_expansion_diff | int
|
||||||
fail_msg: There is not enough space available for LV shrinking.
|
# fail_msg: There is not enough space available for LV shrinking.
|
||||||
|
|
||||||
|
- name: Check for available space and fallback if needed
|
||||||
|
ansible.builtin.import_tasks: check_space_fallback.yml
|
||||||
|
|
||||||
- name: Capture shrink size for logical volume
|
- name: Capture shrink size for logical volume
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
bigboot_lv_shrink_size: "{{ bigboot_lv_info.size_total - bigboot_expansion_diff | int }}"
|
bigboot_lv_shrink_size: "{{ bigboot_lv_info.size_total - bigboot_expansion_diff | int }}"
|
||||||
|
|
||||||
|
- name: Debug bigboot_lv_shrink_size
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "{{ bigboot_lv_shrink_size | int | human_readable(unit='M') }}"
|
||||||
|
|
||||||
|
- name: Kill the play
|
||||||
|
ansible.builtin.meta: end_host
|
||||||
|
|
||||||
- name: Capture logical volume name
|
- name: Capture logical volume name
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: |
|
cmd: |
|
||||||
|
26
tasks/check_space_fallback.yml
Normal file
26
tasks/check_space_fallback.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
- name: Fail if /boot can't expand to at least 1GB
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that: bigboot_size_target | human_to_bytes > 1073741824
|
||||||
|
fail_msg: "{{ bigboot_size_target | int | human_readable(unit='M') }} is less than the minimum of 1GB for /boot"
|
||||||
|
|
||||||
|
- 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 space available for LV shrinking.
|
||||||
|
|
||||||
|
rescue:
|
||||||
|
- name: Decrement size target by .25G
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
bigboot_size_target: "{{ bigboot_size_target | human_to_bytes - 262144000 }}"
|
||||||
|
|
||||||
|
- name: Update required expansion space
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
bigboot_expansion_diff:
|
||||||
|
"{{ bigboot_size_target | human_to_bytes - bigboot_boot_partsize | human_to_bytes }}"
|
||||||
|
|
||||||
|
- name: Re-check disk space - RESCUE
|
||||||
|
ansible.builtin.include_tasks: check_space_fallback.yml
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
ansible_ssh_retries: 10
|
ansible_ssh_retries: 10
|
||||||
|
|
||||||
bigboot_size_target: 1G
|
bigboot_size_target: 2G
|
||||||
|
|
||||||
# Filename of disabled services log:
|
# Filename of disabled services log:
|
||||||
bigboot_disabled_services_log: /var/IPE/IPU/el7to8/bigboot_disabled_services.log
|
bigboot_disabled_services_log: /var/IPE/IPU/el7to8/bigboot_disabled_services.log
|
||||||
|
Loading…
x
Reference in New Issue
Block a user