Merge pull request 'Develop Sync' (#3) from develop into main

Reviewed-on: #3
This commit is contained in:
Chris Hammer 2024-07-22 15:50:22 -04:00
commit 8beb34f553
6 changed files with 101 additions and 97 deletions

1
.gitignore vendored
View File

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

View File

@ -18,79 +18,17 @@
- name: Capture logical volume information - name: Capture logical volume information
ansible.builtin.import_tasks: tasks/capture_lv_device_details.yml ansible.builtin.import_tasks: tasks/capture_lv_device_details.yml
- name: Set environment for subsequent workflow nodes
- name: Perform a ReaR backup if any disk modifications are to be made ansible.builtin.set_stats:
ansible.builtin.import_playbook: rhc.rear.rear_backup data:
when: bigboot_data: "{{ bigboot_data | default({}) |
- bigboot_execute_bigboot | default('false') | bool combine({inventory_hostname:
- not bigboot_skip_rear_backup | default('true') | bool {
'bigboot_execute_bigboot': bigboot_execute_bigboot,
'bigboot_execute_shrink_lv': bigboot_execute_shrink_lv,
- name: Perform logical volume and boot parition resizing as needed 'bigboot_adjacent_lvm_device': bigboot_adjacent_lvm_device,
hosts: all 'bigboot_lv_shrink_size': bigboot_lv_shrink_size | int,
become: true 'bigboot_size': bigboot_size,
gather_facts: true 'bigboot_skip_rear_backup': bigboot_skip_rear | default('false')
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

View File

@ -9,10 +9,25 @@
- bigboot_vars.yml - bigboot_vars.yml
tasks: tasks:
- name: Perform filesystem check prior to Bigboot execution - name: Perform service and filesystem checks prior to Bigboot execution
when: 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: 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 - name: Enable Grub filesystem check
ansible.builtin.import_role: ansible.builtin.import_role:
name: autofsck name: autofsck
@ -33,9 +48,6 @@
- name: Flush handlers - name: Flush handlers
ansible.builtin.meta: 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 - name: Extend the timeout values for physical hosts
ansible.builtin.set_fact: ansible.builtin.set_fact:
@ -49,16 +61,29 @@
name: infra.lvm_snapshots.shrink_lv name: infra.lvm_snapshots.shrink_lv
vars: vars:
shrink_lv_devices: shrink_lv_devices:
- device: "{{ bigboot_adjacent_lvm_device }}" - device: "{{ bigboot_data[inventory_hostname]['bigboot_adjacent_lvm_device'] }}"
size: "{{ bigboot_lv_shrink_size | int }}" size: "{{ bigboot_data[inventory_hostname]['bigboot_lv_shrink_size'] | int }}"
when: when:
- bigboot_execute_shrink_lv | bool - bigboot_data[inventory_hostname]['bigboot_execute_shrink_lv'] | bool
- name: Expand the /boot partition as requested - name: Expand the /boot partition as requested
ansible.builtin.import_role: ansible.builtin.import_role:
name: infra.lvm_snapshots.bigboot name: infra.lvm_snapshots.bigboot
vars:
bigboot_size: "{{ bigboot_data[inventory_hostname]['bigboot_size'] }}"
when: 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 - name: Re-enabling services previously disabled
ansible.builtin.service: 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 ansible.builtin.import_playbook: rhc.rear.rear_backup
when: when:
- bigboot_execute_bigboot | default('false') | bool - (bigboot_data[inventory_hostname]['bigboot_execute_shrink_lv'] | bool
- not bigboot_skip_rear_backup | default('true') | 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 - name: Cleanup from any previous executions
ansible.builtin.import_tasks: tasks/cleanup.yml 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 - name: Capture boot device details
ansible.builtin.import_tasks: tasks/capture_boot_device_details.yml ansible.builtin.import_tasks: tasks/capture_boot_device_details.yml
- name: Capture logical volume information - name: Capture logical volume information
ansible.builtin.import_tasks: tasks/capture_lv_device_details.yml 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 - name: Set environment for subsequent workflow nodes
ansible.builtin.set_stats: ansible.builtin.set_stats:
data: data:
bigboot_execute_bigboot: "{{ bigboot_execute_bigboot }}" bigboot_data: "{{ bigboot_data | default({}) |
bigboot_execute_shrink_lv: "{{ bigboot_execute_shrink_lv }}" combine({inventory_hostname:
bigboot_adjacent_lvm_device: "{{ bigboot_adjacent_lvm_device }}" {
bigboot_lv_shrink_size: "{{ bigboot_lv_shrink_size | int }}" 'bigboot_execute_bigboot': bigboot_execute_bigboot,
bigboot_size: "{{ bigboot_size }}" 'bigboot_execute_shrink_lv': bigboot_execute_shrink_lv,
bigboot_skip_rear_backup: "{{ bigboot_skip_rear | default('false') }}" 'bigboot_adjacent_lvm_device': bigboot_adjacent_lvm_device,
per_host: false 'bigboot_lv_shrink_size': bigboot_lv_shrink_size | int,
aggregate: false '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 bigboot_skip_rear_backup: false
# Max value in minutes for the timeout threshold: # 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 # List of services which will be excluded from being
# disabled during Bigboot execution: # disabled during Bigboot execution: