Compare commits
18 Commits
53f3dbc6c8
...
develop
Author | SHA1 | Date | |
---|---|---|---|
6b3a346d2d | |||
66524c6bb2 | |||
fd809949f7 | |||
971cc1bdfe | |||
6e8726bddd | |||
5d18d161fe | |||
147c63ba89 | |||
5c3987bfa7 | |||
12f1c050cf | |||
943fb1b24f | |||
f39fea0f89 | |||
23c7547f32 | |||
78902c1371 | |||
8e057342da | |||
8106b95478 | |||
a3d5c17253 | |||
5cb1b9d68f | |||
9a9aa83adb |
@ -1,3 +1,3 @@
|
|||||||
export ANSIBLE_LINT_EXCLUSION="--exclude collections/ansible_collections --exclude .gitea"
|
export ANSIBLE_LINT_EXCLUSION="--exclude collections/ansible_collections --exclude .gitea"
|
||||||
export ANSIBLE_INVENTORY="-i 127.0.0.1, --connection=local"
|
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:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- develop
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Ansible-Development-Pipeline:
|
Ansible-Development-Pipeline:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ansible-dev-centos9, ansible-dev-fedora39, ansible-dev-debian11, ansible-dev-debian12 ]
|
os: [ ansible-dev-fedora41 ]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Clone repository
|
- name: Clone repository
|
||||||
@ -17,7 +17,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Ansible Environment Verify
|
- name: Ansible Environment Verify
|
||||||
run: |
|
run: |
|
||||||
. ./.drone.env
|
. ./.ci.env
|
||||||
env
|
env
|
||||||
git log -1
|
git log -1
|
||||||
ansible --version
|
ansible --version
|
||||||
@ -29,7 +29,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Run Ansible-Lint
|
- name: Run Ansible-Lint
|
||||||
run: |
|
run: |
|
||||||
. ./.drone.env
|
. ./.ci.env
|
||||||
ansible-lint --offline $ANSIBLE_LINT_EXCLUSION
|
ansible-lint --offline $ANSIBLE_LINT_EXCLUSION
|
||||||
|
|
||||||
# - name: Run Ansible-Playbook
|
# - name: Run Ansible-Playbook
|
||||||
|
@ -7,7 +7,9 @@ class FilterModule (object):
|
|||||||
return {
|
return {
|
||||||
'get_block_size_up': self.get_block_size_up,
|
'get_block_size_up': self.get_block_size_up,
|
||||||
'get_block_size_down': self.get_block_size_down,
|
'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
|
start_size -= 1
|
||||||
return ('{}{}'.format(start_size, 'M'))
|
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):
|
def moo(self, a_variable):
|
||||||
a_new_variable = (str(a_variable) + '~~~~MOOOOOOOOOOOOOOOOOOOOOOOOO! => ' + '%s' % type(a_variable))
|
a_new_variable = (str(a_variable) + '~~~~MOOOOOOOOOOOOOOOOOOOOOOOOO! => ' + '%s' % type(a_variable))
|
||||||
return a_new_variable
|
return a_new_variable
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
that: bigboot_boot_partsize | human_to_bytes >= bigboot_size_min | human_to_bytes
|
that: bigboot_boot_partsize | human_to_bytes >= bigboot_size_min | human_to_bytes
|
||||||
success_msg: >
|
success_msg: >
|
||||||
/boot partition size is already at least {{ bigboot_size_min }}
|
/boot partition size is already at least {{ bigboot_size_min }}
|
||||||
or greater. Nothing to do."
|
or greater. Nothing to do.
|
||||||
fail_msg: >
|
fail_msg: >
|
||||||
/boot partition size is less than {{ bigboot_size_min }}.
|
/boot partition size is less than {{ bigboot_size_min }}.
|
||||||
Expansion of /boot is required.
|
Expansion of /boot is required.
|
||||||
@ -54,5 +54,5 @@
|
|||||||
- name: Expansion of /boot required
|
- name: Expansion of /boot required
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: >
|
msg: >
|
||||||
Will attempt to increase to {{ bigboot_size_target }}, or
|
Will attempt to increase to {{ bigboot_size_target }},
|
||||||
{{ bigboot_size_min }} at the minimum."
|
or {{ bigboot_size_min }} at the minimum.
|
||||||
|
@ -47,8 +47,17 @@
|
|||||||
# 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: Set initial target size for fallback
|
- name: Capture UUID for target volume
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
|
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 }}"
|
bigboot_size_target_fallback: "{{ bigboot_size_target | human_to_bytes }}"
|
||||||
|
|
||||||
- name: Check available space and fallback to lower /boot size if required
|
- name: Check available space and fallback to lower /boot size if required
|
||||||
@ -56,15 +65,13 @@
|
|||||||
|
|
||||||
- name: Capture shrink and fallback sizes
|
- name: Capture shrink and fallback sizes
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
bigboot_lv_shrink_size: "{{ bigboot_lv_info['size_total'] - bigboot_expansion_diff | int }}"
|
# 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') }}"
|
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
|
- name: Debug bigboot_lv_shrink_size and bigboot_size_target_fallback
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ bigboot_lv_shrink_size | int | human_readable(unit='G') }} <-> {{ bigboot_size_target_fallback }} | {{ bigboot_expansion_diff }}"
|
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: Kill the play
|
|
||||||
# ansible.builtin.meta: end_host
|
|
||||||
|
|
||||||
- name: Capture logical volume name
|
- name: Capture logical volume name
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
@ -88,6 +95,23 @@
|
|||||||
changed_when: false
|
changed_when: false
|
||||||
register: bigboot_lv_vg_free_pe
|
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
|
- name: Capture the PV device
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
bigboot_pv: "{{ bigboot_boot_mount['device'][:-1] }}{{ bigboot_boot_mount['device'][-1:] | int + 1 }}"
|
bigboot_pv: "{{ bigboot_boot_mount['device'][:-1] }}{{ bigboot_boot_mount['device'][-1:] | int + 1 }}"
|
||||||
@ -116,7 +140,7 @@
|
|||||||
- name: Assert if we need to shrink the logical volume to gain PE
|
- name: Assert if we need to shrink the logical volume to gain PE
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: (bigboot_lv_pe_size_in_mb[:-3] | int) >= (bigboot_expansion_diff_mb[:-3] | int)
|
that: (bigboot_lv_pe_size_in_mb[:-3] | int) >= (bigboot_expansion_diff_mb[:-3] | int)
|
||||||
fail_msg: Not enough PE to expand /boot. Will need to shrink target LV.
|
fail_msg: Not enough PE to expand /boot.
|
||||||
|
|
||||||
rescue:
|
rescue:
|
||||||
- name: Set flag for Shrink_LV execution
|
- name: Set flag for Shrink_LV execution
|
||||||
|
@ -19,13 +19,14 @@
|
|||||||
- name: Assert that there will be enough space left over on the target LV
|
- name: Assert that there will be enough space left over on the target LV
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: (bigboot_lv_info['size_available'] - bigboot_expansion_diff | int) >= bigboot_lv_size_min | human_to_bytes
|
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_available'] - bigboot_expansion_diff | int) | human_readable(unit='B') }})"
|
# 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') }}. Aborting Bigboot execution."
|
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:
|
rescue:
|
||||||
- name: "Decrement size target by {{ bigboot_size_decrement }}"
|
- name: "Decrement size target by {{ bigboot_size_decrement }}"
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
bigboot_size_target_fallback: "{{ bigboot_size_target_fallback | int - bigboot_size_decrement | human_to_bytes }}"
|
bigboot_size_target_fallback:
|
||||||
|
"{{ bigboot_size_target_fallback | int - bigboot_size_decrement | human_to_bytes }}"
|
||||||
|
|
||||||
- name: Update required expansion space
|
- name: Update required expansion space
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
|
@ -4,7 +4,6 @@ ansible_ssh_retries: 10
|
|||||||
bigboot_size_target: 2G
|
bigboot_size_target: 2G
|
||||||
bigboot_size_min: 1G
|
bigboot_size_min: 1G
|
||||||
bigboot_size_decrement: 250M
|
bigboot_size_decrement: 250M
|
||||||
|
|
||||||
bigboot_lv_size_min: 1G
|
bigboot_lv_size_min: 1G
|
||||||
|
|
||||||
# Filename of disabled services log:
|
# Filename of disabled services log:
|
||||||
|
Reference in New Issue
Block a user