add bigboot-v2.yml playbook; adds support to be resuced by calling shrink_lv if bigboot initially fails, then calls bigboot to resize
All checks were successful
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-centos9) (push) Successful in 18s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-debian11) (push) Successful in 14s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-debian12) (push) Successful in 14s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-fedora39) (push) Successful in 15s
All checks were successful
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-centos9) (push) Successful in 18s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-debian11) (push) Successful in 14s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-debian12) (push) Successful in 14s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-fedora39) (push) Successful in 15s
This commit is contained in:
parent
d66f7d5f32
commit
9ed2241b03
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
inventory/*
|
||||
*.bak
|
||||
|
44
bigboot-v2.yml
Normal file
44
bigboot-v2.yml
Normal file
@ -0,0 +1,44 @@
|
||||
---
|
||||
- name: Resize /boot partition on target host
|
||||
hosts: all
|
||||
become: true
|
||||
gather_facts: true
|
||||
|
||||
tasks:
|
||||
- name: Resize boot partition
|
||||
block:
|
||||
- name: Execute Bigboot role to resize /boot
|
||||
ansible.builtin.import_role:
|
||||
name: infra.lvm_snapshots.bigboot
|
||||
|
||||
rescue:
|
||||
- name: Get the target device information and calculate padding
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_shrink_target_info: "{{ ansible_facts.mounts \
|
||||
| selectattr('device', 'equalto', bigboot_shrink_target) | first }}"
|
||||
bigboot_size_padded: (bigboot_size | human_to_bytes * bigboot_shrink_padding) | int
|
||||
|
||||
- name: Calculate the new logical volume size
|
||||
ansible.builtin.set_fact:
|
||||
shrink_lv_volume_size: "{{ (bigboot_shrink_target_info.size_total - bigboot_size_padded | int) \
|
||||
| ansible.builtin.human_readable | ansible.builtin.regex_replace(' ', '') }}"
|
||||
|
||||
- name: Show resize information
|
||||
ansible.builtin.debug:
|
||||
msg: "Shrinking {{ bigboot_shrink_target }} from \
|
||||
{{ bigboot_shrink_target_info.size_total | ansible.builtin.human_readable }} to \
|
||||
{{ shrink_lv_volume_size[:-1] | ansible.builtin.regex_replace('^(\\d+)\\.\\d+(\\w).*', '\\1\\2') }} \
|
||||
to expand /boot partition by {{ bigboot_size }}."
|
||||
|
||||
- name: Execute Shrink_LV role to resize target logical volume
|
||||
ansible.builtin.import_role:
|
||||
name: infra.lvm_snapshots.shrink_lv
|
||||
vars:
|
||||
shrink_lv_devices:
|
||||
- device: "{{ bigboot_shrink_target }}"
|
||||
size: "{{ shrink_lv_volume_size[:-1] \
|
||||
| ansible.builtin.regex_replace('^(\\d+)\\.\\d+(\\w).*', '\\1\\2') }}"
|
||||
|
||||
- name: Execute Bigboot role to resize /boot
|
||||
ansible.builtin.import_role:
|
||||
name: infra.lvm_snapshots.bigboot
|
6
group_vars/all
Normal file
6
group_vars/all
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
# We use padding just to ensure that there's available
|
||||
# space to expand /boot to.
|
||||
#
|
||||
# By default the value is 1.10, or 10%
|
||||
bigboot_shrink_padding: 1.10
|
Loading…
x
Reference in New Issue
Block a user