Develop Sync #3

Merged
chris merged 27 commits from develop into main 2024-07-22 15:50:22 -04:00
6 changed files with 101 additions and 97 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ filter_plugins/*.bak
python/
collections/ansible_collections
roles/autofsck
*.bak

View File

@ -18,79 +18,17 @@
- name: Capture logical volume information
ansible.builtin.import_tasks: tasks/capture_lv_device_details.yml
- name: Perform a ReaR backup if any disk modifications are to be made
ansible.builtin.import_playbook: rhc.rear.rear_backup
when:
- bigboot_execute_bigboot | default('false') | bool
- not bigboot_skip_rear_backup | default('true') | bool
- 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: Perform filesystem check prior to Bigboot execution
when:
- (bigboot_execute_shrink_lv | bool or bigboot_execute_bigboot | bool)
block:
- name: Enable Grub filesystem check
ansible.builtin.import_role:
name: autofsck
tasks_from: main.yml
- name: Flush handlers
ansible.builtin.meta: flush_handlers
# Make sure to update the reboot code for the WF environment
- name: Reboot to run filesystem checks
ansible.builtin.reboot:
- name: Disable Grub filesystem check
ansible.builtin.import_role:
name: autofsck
tasks_from: cleanup.yml
- name: Flush handlers
ansible.builtin.meta: flush_handlers
- name: Check for and disable services exceeding the timeout threshold
ansible.builtin.import_tasks: tasks/check_systemd_services.yml
- name: Extend the timeout values for physical hosts
ansible.builtin.set_fact:
initramfs_post_reboot_delay: 300
initramfs_reboot_timeout: 14400
when:
- "'host' in ansible_virtualization_role"
- name: Shrink the logical volume to support /boot expansion
ansible.builtin.debug:
msg:
- "device: {{ bigboot_adjacent_lvm_device }}"
- "size : {{ bigboot_lv_shrink_size | int }}"
when:
- bigboot_execute_shrink_lv | bool
- name: Expand the /boot partition as requested
ansible.builtin.debug:
msg: "{{ bigboot_size }}"
when:
- bigboot_execute_bigboot | bool
- name: Re-enabling services previously disabled
ansible.builtin.service:
name: "{{ item }}"
state: started
enabled: true
loop: "{{ bigboot_systemd_disabled_services }}"
when:
- bigboot_systemd_disabled_services is defined
- bigboot_systemd_disabled_services | length > 0
- name: Set environment for subsequent workflow nodes
ansible.builtin.set_stats:
data:
bigboot_data: "{{ bigboot_data | default({}) |
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_size': bigboot_size,
'bigboot_skip_rear_backup': bigboot_skip_rear | default('false')
}
})}}"

View File

@ -9,10 +9,25 @@
- bigboot_vars.yml
tasks:
- name: Perform filesystem check prior to Bigboot execution
- name: Perform service and filesystem checks prior to Bigboot execution
when:
- (bigboot_execute_shrink_lv | bool or bigboot_execute_bigboot | bool)
- (bigboot_data[inventory_hostname]['bigboot_execute_shrink_lv'] | bool
or bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | bool)
block:
- name: Check for and disable services exceeding the timeout threshold
ansible.builtin.import_tasks: tasks/check_systemd_services.yml
- name: Services disabled notice
ansible.builtin.debug:
msg: >-
The following services were disabled, and will be re-enabled post
Bigboot execution:
{{ bigboot_systemd_disabled_services | flatten }}
when:
- bigboot_systemd_disabled_services is defined
- bigboot_systemd_disabled_services | length > 0
- name: Enable Grub filesystem check
ansible.builtin.import_role:
name: autofsck
@ -33,9 +48,6 @@
- name: Flush handlers
ansible.builtin.meta: flush_handlers
- name: Check for and disable services exceeding the timeout threshold
ansible.builtin.import_tasks: tasks/check_systemd_services.yml
- name: Extend the timeout values for physical hosts
ansible.builtin.set_fact:
@ -49,16 +61,29 @@
name: infra.lvm_snapshots.shrink_lv
vars:
shrink_lv_devices:
- device: "{{ bigboot_adjacent_lvm_device }}"
size: "{{ bigboot_lv_shrink_size | int }}"
- device: "{{ bigboot_data[inventory_hostname]['bigboot_adjacent_lvm_device'] }}"
size: "{{ bigboot_data[inventory_hostname]['bigboot_lv_shrink_size'] | int }}"
when:
- bigboot_execute_shrink_lv | bool
- bigboot_data[inventory_hostname]['bigboot_execute_shrink_lv'] | bool
- name: Expand the /boot partition as requested
ansible.builtin.import_role:
name: infra.lvm_snapshots.bigboot
vars:
bigboot_size: "{{ bigboot_data[inventory_hostname]['bigboot_size'] }}"
when:
- bigboot_execute_bigboot | bool
- bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | bool
- name: Get the list of services on the host
ansible.builtin.service_facts:
- name: Re-enabling Docker service
ansible.builtin.service:
name: docker.service
state: started
enabled: true
when:
- "'docker.service' in ansible_facts['services']"
- name: Re-enabling services previously disabled
ansible.builtin.service:

View File

@ -1,6 +1,22 @@
---
- name: Perform a ReaR backup if any disk modifications are to be made
- name: Capture boot and logical volume information
hosts: all
become: true
gather_facts: true
strategy: free
tasks:
- name: Debug bigboot_execute_shrink_lv
ansible.builtin.debug:
msg: "bigboot_data[inventory_hostname]['bigboot_execute_shrink_lv'] -> {{ bigboot_data[inventory_hostname]['bigboot_execute_shrink_lv'] }}"
- name: Debug bigboot_execute_bigboot
ansible.builtin.debug:
msg: "bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] -> {{ bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] }}"
- name: Perform a ReaR backup before the /boot expansion
ansible.builtin.import_playbook: rhc.rear.rear_backup
when:
- bigboot_execute_bigboot | default('false') | bool
- not bigboot_skip_rear_backup | default('true') | bool
- (bigboot_data[inventory_hostname]['bigboot_execute_shrink_lv'] | bool
or bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | bool)
- not bigboot_rear_backup_skip | default(false) | bool

View File

@ -12,22 +12,46 @@
- name: Cleanup from any previous executions
ansible.builtin.import_tasks: tasks/cleanup.yml
- name: Get the list of services on the host
ansible.builtin.service_facts:
- name: Disable Docker service due to incompatibility
ansible.builtin.service:
name: docker.service
state: stopped
enabled: false
when:
- "'docker.service' in ansible_facts['services']"
- name: Capture boot device details
ansible.builtin.import_tasks: tasks/capture_boot_device_details.yml
- name: Capture logical volume information
ansible.builtin.import_tasks: tasks/capture_lv_device_details.yml
- name: Set ReaR backup flag
ansible.builtin.set_fact:
bigboot_rear_backup_skip:
- name: Set environment for subsequent workflow nodes
ansible.builtin.set_stats:
data:
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_size: "{{ bigboot_size }}"
bigboot_skip_rear_backup: "{{ bigboot_skip_rear | default('false') }}"
per_host: false
aggregate: false
bigboot_data: "{{ bigboot_data | default({}) |
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_size': bigboot_size
}
}) }}"
rear_backup_skip: "{{ bigboot_rear_backup_skip | default(false) }}"
- name: Perform a ReaR backup if any disk modifications are to be made
ansible.builtin.import_playbook: rhc.rear.rear_backup
when:
- bigboot_execute_bigboot | bool or bigboot_execute_bigboot | bool
- not bigboot_rear_backup_skip | default(false) | bool
...

View File

@ -9,7 +9,7 @@ bigboot_reboot_timeout: 1800
bigboot_skip_rear_backup: false
# Max value in minutes for the timeout threshold:
bigboot_service_max_timeout: 2
bigboot_service_max_timeout: 5
# List of services which will be excluded from being
# disabled during Bigboot execution: