Compare commits

...

33 Commits

Author SHA1 Message Date
05ad0d4c36 Merge pull request 'Sync with develop' (#4) from develop into main
Reviewed-on: #4
2024-08-02 10:12:57 -04:00
27d5965e82 Add service fact gathering 2024-08-01 10:55:04 -04:00
782aa94210 Add reboot code to match scneario 2024-08-01 10:41:45 -04:00
339dcdd6ad Task reorder/move; log path update 2024-08-01 10:13:25 -04:00
8245abf806 Fix conditional; cant check string against integer 2024-07-31 23:29:03 -04:00
490170e752 Task shift 2024-07-31 12:28:58 -04:00
a8fdf951c4 Task file re-name 2024-07-31 12:12:56 -04:00
e53e97cf9a Fix Docker service management; relocate Grub fsck 2024-07-31 11:53:25 -04:00
0b11597038 Logic prune 2024-07-31 10:03:36 -04:00
4ca8d421e2 More shufflin ¯\_(ツ)_/¯ 2024-07-30 18:05:08 -04:00
fad845dd1d Doing the task shuffle. ¯\_(ツ)_/¯ 2024-07-30 17:48:03 -04:00
b440005e55 Var fix. 2024-07-30 17:31:12 -04:00
94c4366903 Indent fix. Yes, again. 2024-07-30 17:27:39 -04:00
b7b6f9555d Indent fix. 2024-07-30 17:25:52 -04:00
64f1220935 That task wasnt supposed to be there! 2024-07-30 17:23:20 -04:00
664291b15d Support for logging of disabled services 2024-07-30 17:16:57 -04:00
f655d19716 fixes 2024-07-29 16:08:33 -04:00
205101856b add filters 2024-07-26 15:55:40 -04:00
42709c4fe6 variable naming fix 2024-07-26 15:51:34 -04:00
050939b52a add default 2024-07-26 15:42:23 -04:00
22d4c220ab fix hosts 2024-07-26 14:16:28 -04:00
d7c73f1a97 refactor 2024-07-26 14:12:10 -04:00
fd108e2b69 import->include 2024-07-26 11:40:03 -04:00
51ba92ecd7 fix playbook 2024-07-26 11:36:17 -04:00
2b31c70a8c add task to check workaround for set_stats 2024-07-26 11:31:54 -04:00
6a0b9ff2ba fix docker service management 2024-07-23 23:21:29 -04:00
427e817ba6 fix aggregate 2024-07-23 16:32:05 -04:00
ef87a6f20e aggregate 2024-07-23 16:29:01 -04:00
eccb4d523a fix per_host 2024-07-23 15:57:51 -04:00
7c31c184d4 per_host 2024-07-23 15:56:14 -04:00
4a1f42bea0 remove aggregate/per_host 2024-07-23 15:45:09 -04:00
c5ccbf28cb remove problematic debugging code 2024-07-23 15:35:27 -04:00
4ee78bead1 fixes for multiple hosts 2024-07-23 15:20:10 -04:00
12 changed files with 144 additions and 81 deletions

View File

@ -5,3 +5,4 @@ skip_list:
- no-changed-when
- run-once[play]
- name[template]
- jinja[spacing]

View File

@ -11,42 +11,13 @@
tasks:
- name: Perform service and filesystem checks prior to Bigboot execution
when:
- (bigboot_data[inventory_hostname]['bigboot_execute_shrink_lv'] | bool
or bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | bool)
- bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | 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
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: Perform filesystem check prior to Bigboot execution
ansible.builtin.import_tasks: tasks/grub_filesystem_check.yml
- name: Extend the timeout values for physical hosts
@ -74,16 +45,16 @@
when:
- bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | bool
- name: Get the list of services on the host
- name: Ensure service facts are available
ansible.builtin.service_facts:
- name: Re-enabling Docker service
- name: Restore Docker service to its pre-Bigboot state
ansible.builtin.service:
name: docker.service
state: started
enabled: true
name: "{{ bigboot_docker_service }}"
state: "{{ bigboot_data[inventory_hostname]['bigboot_docker_running'] }}"
enabled: "{{ bigboot_data[inventory_hostname]['bigboot_docker_enabled'] }}"
when:
- "'docker.service' in ansible_facts['services']"
- ansible_facts['services'][bigboot_docker_service] is defined
- name: Re-enabling services previously disabled
ansible.builtin.service:

View File

@ -1,22 +1,6 @@
---
- 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_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
- bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool
- not rear_backup_skip | default(false) | bool

View File

@ -0,0 +1,19 @@
---
- name: Perform logical volume and boot parition resizing as needed
hosts: rear_server
become: true
gather_facts: false
vars_files:
- bigboot_vars.yml
tasks:
- name: Create IP list and add to NFS exports
ansible.builtin.include_tasks: tasks/rear_nfs_exports.yml
loop: "{{ bigboot_data | dict2items }}"
loop_control:
label: "{{ item['key'] }}"
when:
- item['value']['bigboot_execute_bigboot'] | default(false) | bool
- not rear_backup_skip | default(false) | bool

View File

@ -12,29 +12,18 @@
- 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: Stop and disable the Docker service if present and running
ansible.builtin.import_tasks: tasks/disable_docker_service.yml
- 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: Set boot device details
ansible.builtin.import_tasks: tasks/capture_boot_device_details.yml
- name: Capture logical volume information
- name: Set 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:
aggregate: true
data:
bigboot_data: "{{ bigboot_data | default({}) |
combine({inventory_hostname:
@ -43,15 +32,12 @@
'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_size': bigboot_size,
'bigboot_docker_running': bigboot_docker_running,
'bigboot_docker_enabled': bigboot_docker_enabled,
'ip_addresses': ansible_all_ipv4_addresses,
'server_hostname': ansible_hostname
}
}) }}"
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

@ -28,4 +28,13 @@
label: "{{ item['item'] }}"
when:
- item['item'] not in bigboot_protected_services
- item['stdout'] | regex_replace('^.*=(.*$)', '\\1') | community.general.to_minutes > bigboot_service_max_timeout
- item['stdout'] | regex_replace('^.*=(.*$)', '\\1') | community.general.to_minutes >= bigboot_service_max_timeout | int
- 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 | join(',') }}
when:
- bigboot_systemd_disabled_services is defined
- bigboot_systemd_disabled_services | length > 0

View File

@ -29,4 +29,16 @@
path: "/boot/initramfs-{{ initramfs_kernel_version }}.img.{{ initramfs_backup_extension }}"
state: absent
- name: Check if disable services log exists
ansible.builtin.stat:
path: "{{ bigboot_disabled_services_log }}"
register: bigboot_disabled_services_log_stat
- name: Remove disabled services log if present
ansible.builtin.file:
path: "{{ bigboot_disabled_services_log }}"
state: absent
when:
- bigboot_disabled_services_log_stat['stat']['exists'] | bool
...

View File

@ -0,0 +1,25 @@
---
- name: Ensure service facts are available
ansible.builtin.service_facts:
- name: Set Docker state
when:
- ansible_facts['services'][bigboot_docker_service] is defined
block:
- name: Set Docker running state
ansible.builtin.set_fact:
bigboot_docker_running: started
when:
- ansible_facts['services'][bigboot_docker_service]['state'] == "running"
- name: Set Docker enabled state
ansible.builtin.set_fact:
bigboot_docker_enabled: true
when:
- ansible_facts['services'][bigboot_docker_service]['status'] == "enabled"
- name: Ensure Docker service is stopped and disabled
ansible.builtin.service:
name: "{{ bigboot_docker_service }}"
state: stopped
enabled: false

View File

@ -9,3 +9,13 @@
ansible.builtin.set_fact:
bigboot_systemd_disabled_services:
"{{ bigboot_systemd_disabled_services | default([]) + [item['item']] }}"
- name: Log disabled service to log file
ansible.builtin.lineinfile:
path: "{{ bigboot_disabled_services_log }}"
line: "{{ item['item'] }}"
create: true
state: present
owner: root
group: root
mode: "0600"

View File

@ -0,0 +1,30 @@
---
- name: Enable Grub filesystem check
ansible.builtin.import_role:
name: autofsck
tasks_from: main.yml
- name: Flush handlers to add Grub parameters for fsck
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: Reboot to run filesystem checks
ansible.builtin.command: /sbin/shutdown -r +1
- name: Wait for the reboot to complete
ansible.builtin.wait_for_connection:
connect_timeout: 20
sleep: 10
delay: "{{ bigboot_post_reboot_delay | default('70') }}"
timeout: "{{ bigboot_reboot_timeout | default('1800') }}"
- name: Disable Grub filesystem check
ansible.builtin.import_role:
name: autofsck
tasks_from: cleanup.yml
- name: Flush handlers to remove Grub parameters for fsck
ansible.builtin.meta: flush_handlers

View File

@ -0,0 +1,9 @@
---
- name: Create list of IP addresses and hostnames
ansible.builtin.set_fact:
client_ips: "{{ item['value']['ip_addresses'] | list | flatten }}"
namehost: "{{ item['value']['server_hostname'] }}"
- name: Include NFS export role
ansible.builtin.include_role:
name: rhc.rear.say_hi

View File

@ -8,6 +8,10 @@ bigboot_reboot_timeout: 1800
bigboot_skip_rear_backup: false
bigboot_docker_service: docker.service
bigboot_docker_running: stopped
bigboot_docker_enabled: false
# Max value in minutes for the timeout threshold:
bigboot_service_max_timeout: 5
@ -20,3 +24,6 @@ bigboot_protected_services:
- rhnsd.service
- rhnsd
- boksm.service
# Filename of disabled services log:
bigboot_disabled_services_log: /root/bigboot_disabled_services.log