From 4ee78bead1472a761ec79c870bdcdf791f8b74c2 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 23 Jul 2024 15:20:10 -0400 Subject: [PATCH 01/32] fixes for multiple hosts --- .ansible-lint | 1 + bigboot_execute_resize.yml | 6 +++--- bigboot_rear_backup.yml | 4 ++-- bigboot_setup_environment.yml | 7 +++++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index d8dc293..c1fba50 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -5,3 +5,4 @@ skip_list: - no-changed-when - run-once[play] - name[template] + - jinja[spacing] diff --git a/bigboot_execute_resize.yml b/bigboot_execute_resize.yml index 8fc4a30..664ac97 100644 --- a/bigboot_execute_resize.yml +++ b/bigboot_execute_resize.yml @@ -11,8 +11,8 @@ 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_shrink_lv'] | default(false) | bool + or 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 @@ -23,7 +23,7 @@ The following services were disabled, and will be re-enabled post Bigboot execution: - {{ bigboot_systemd_disabled_services | flatten }} + {{ bigboot_systemd_disabled_services | list | flatten }} when: - bigboot_systemd_disabled_services is defined - bigboot_systemd_disabled_services | length > 0 diff --git a/bigboot_rear_backup.yml b/bigboot_rear_backup.yml index 786c8c7..6cbd66e 100644 --- a/bigboot_rear_backup.yml +++ b/bigboot_rear_backup.yml @@ -17,6 +17,6 @@ - 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) + - (bigboot_data[inventory_hostname]['bigboot_execute_shrink_lv'] | default(false) | bool + or bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool) - not bigboot_rear_backup_skip | default(false) | bool diff --git a/bigboot_setup_environment.yml b/bigboot_setup_environment.yml index 1d356a0..0b1b545 100644 --- a/bigboot_setup_environment.yml +++ b/bigboot_setup_environment.yml @@ -35,6 +35,9 @@ - name: Set environment for subsequent workflow nodes ansible.builtin.set_stats: + aggregate: false + per_host: false + data: bigboot_data: "{{ bigboot_data | default({}) | combine({inventory_hostname: @@ -46,12 +49,12 @@ '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 + - bigboot_execute_shrink_lv | default(false) | bool + or bigboot_execute_bigboot | default(false) | bool - not bigboot_rear_backup_skip | default(false) | bool ... -- 2.47.1 From c5ccbf28cb0f32870af6be54664fa30f66557309 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 23 Jul 2024 15:35:27 -0400 Subject: [PATCH 02/32] remove problematic debugging code --- bigboot_rear_backup.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/bigboot_rear_backup.yml b/bigboot_rear_backup.yml index 6cbd66e..3ab6b4a 100644 --- a/bigboot_rear_backup.yml +++ b/bigboot_rear_backup.yml @@ -1,19 +1,4 @@ --- -- 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: -- 2.47.1 From 4a1f42bea0bdefe8c9007b4b15af903474d9a4da Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 23 Jul 2024 15:45:09 -0400 Subject: [PATCH 03/32] remove aggregate/per_host --- bigboot_setup_environment.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/bigboot_setup_environment.yml b/bigboot_setup_environment.yml index 0b1b545..b0c968f 100644 --- a/bigboot_setup_environment.yml +++ b/bigboot_setup_environment.yml @@ -35,9 +35,6 @@ - name: Set environment for subsequent workflow nodes ansible.builtin.set_stats: - aggregate: false - per_host: false - data: bigboot_data: "{{ bigboot_data | default({}) | combine({inventory_hostname: -- 2.47.1 From 7c31c184d49d0128acdfc94fe679192df89303ff Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 23 Jul 2024 15:56:14 -0400 Subject: [PATCH 04/32] per_host --- bigboot_setup_environment.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bigboot_setup_environment.yml b/bigboot_setup_environment.yml index b0c968f..815be69 100644 --- a/bigboot_setup_environment.yml +++ b/bigboot_setup_environment.yml @@ -34,6 +34,7 @@ bigboot_rear_backup_skip: - name: Set environment for subsequent workflow nodes + per_host: false ansible.builtin.set_stats: data: bigboot_data: "{{ bigboot_data | default({}) | @@ -52,6 +53,6 @@ when: - bigboot_execute_shrink_lv | default(false) | bool or bigboot_execute_bigboot | default(false) | bool - - not bigboot_rear_backup_skip | default(false) | bool + - not rear_backup_skip | default(false) | bool ... -- 2.47.1 From eccb4d523a3c81e85bbec4f0efe07449071ca17a Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 23 Jul 2024 15:57:51 -0400 Subject: [PATCH 05/32] fix per_host --- bigboot_setup_environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigboot_setup_environment.yml b/bigboot_setup_environment.yml index 815be69..78c03ea 100644 --- a/bigboot_setup_environment.yml +++ b/bigboot_setup_environment.yml @@ -34,8 +34,8 @@ bigboot_rear_backup_skip: - name: Set environment for subsequent workflow nodes - per_host: false ansible.builtin.set_stats: + per_host: false data: bigboot_data: "{{ bigboot_data | default({}) | combine({inventory_hostname: -- 2.47.1 From ef87a6f20e9ba889cd1093ed78f75e42b8058ed9 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 23 Jul 2024 16:29:01 -0400 Subject: [PATCH 06/32] aggregate --- bigboot_setup_environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigboot_setup_environment.yml b/bigboot_setup_environment.yml index 78c03ea..ae8b766 100644 --- a/bigboot_setup_environment.yml +++ b/bigboot_setup_environment.yml @@ -35,7 +35,7 @@ - name: Set environment for subsequent workflow nodes ansible.builtin.set_stats: - per_host: false + aggregate: false data: bigboot_data: "{{ bigboot_data | default({}) | combine({inventory_hostname: -- 2.47.1 From 427e817ba6fa70d80c34dd292e6de1dd5660856a Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 23 Jul 2024 16:32:05 -0400 Subject: [PATCH 07/32] fix aggregate --- bigboot_setup_environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigboot_setup_environment.yml b/bigboot_setup_environment.yml index ae8b766..87eb302 100644 --- a/bigboot_setup_environment.yml +++ b/bigboot_setup_environment.yml @@ -35,7 +35,7 @@ - name: Set environment for subsequent workflow nodes ansible.builtin.set_stats: - aggregate: false + aggregate: true data: bigboot_data: "{{ bigboot_data | default({}) | combine({inventory_hostname: -- 2.47.1 From 6a0b9ff2ba633099f5cf54db79112131b949991a Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 23 Jul 2024 23:21:29 -0400 Subject: [PATCH 08/32] fix docker service management --- bigboot_setup_environment.yml | 19 ++++++++++++------- vars/bigboot_vars.yml | 2 ++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/bigboot_setup_environment.yml b/bigboot_setup_environment.yml index 87eb302..16968cf 100644 --- a/bigboot_setup_environment.yml +++ b/bigboot_setup_environment.yml @@ -15,13 +15,13 @@ - name: Get the list of services on the host ansible.builtin.service_facts: - - name: Disable Docker service due to incompatibility + - name: Stop Docker service due to incompatibility ansible.builtin.service: name: docker.service state: stopped - enabled: false when: - - "'docker.service' in ansible_facts['services']" + - ansible_facts['services'][bigboot_docker_service] is defined + - ansible_facts['services'][bigboot_docker_service]['state'] == "running" - name: Capture boot device details ansible.builtin.import_tasks: tasks/capture_boot_device_details.yml @@ -29,10 +29,6 @@ - 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: aggregate: true @@ -48,6 +44,15 @@ } }) }}" + - name: Restore Docker service to its previous running state + ansible.builtin.service: + name: docker.service + state: started + when: + - ansible_facts['services'][bigboot_docker_service] is defined + - ansible_facts['services'][bigboot_docker_service]['state'] == "running" + + - name: Perform a ReaR backup if any disk modifications are to be made ansible.builtin.import_playbook: rhc.rear.rear_backup when: diff --git a/vars/bigboot_vars.yml b/vars/bigboot_vars.yml index 825299f..4f7074d 100644 --- a/vars/bigboot_vars.yml +++ b/vars/bigboot_vars.yml @@ -8,6 +8,8 @@ bigboot_reboot_timeout: 1800 bigboot_skip_rear_backup: false +bigboot_docker_service: docker.service + # Max value in minutes for the timeout threshold: bigboot_service_max_timeout: 5 -- 2.47.1 From 2b31c70a8c8b0dc41a160adca88b9bac5e6c2c04 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 26 Jul 2024 11:31:54 -0400 Subject: [PATCH 09/32] add task to check workaround for set_stats --- bigboot_rear_backup.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bigboot_rear_backup.yml b/bigboot_rear_backup.yml index 3ab6b4a..dc3af98 100644 --- a/bigboot_rear_backup.yml +++ b/bigboot_rear_backup.yml @@ -5,3 +5,15 @@ - (bigboot_data[inventory_hostname]['bigboot_execute_shrink_lv'] | default(false) | bool or bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool) - not bigboot_rear_backup_skip | default(false) | bool + +- name: ReaR backup per host + ansible.builtin.import_role: + name: rhc.rear.rear_backup + vars: + client_ips: "{{ item['value']['bigboot_size'] }}" + namehost: "{{ item['key'] }}" + loop: "{{ bigboot_data | dict2items }}" + loop_control: + label: "{{ item['key'] }}" + when: + - item['value']['bigboot_execute_bigboot'] | bool -- 2.47.1 From 51ba92ecd7a750a102568cfa5e91395c93944866 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 26 Jul 2024 11:36:17 -0400 Subject: [PATCH 10/32] fix playbook --- bigboot_rear_backup.yml | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/bigboot_rear_backup.yml b/bigboot_rear_backup.yml index dc3af98..a53060d 100644 --- a/bigboot_rear_backup.yml +++ b/bigboot_rear_backup.yml @@ -1,19 +1,23 @@ --- -- 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'] | default(false) | bool - or bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool) - - not bigboot_rear_backup_skip | default(false) | bool +- name: Perform logical volume and boot parition resizing as needed + hosts: all + become: true + gather_facts: true + strategy: free -- name: ReaR backup per host - ansible.builtin.import_role: - name: rhc.rear.rear_backup - vars: - client_ips: "{{ item['value']['bigboot_size'] }}" - namehost: "{{ item['key'] }}" - loop: "{{ bigboot_data | dict2items }}" - loop_control: - label: "{{ item['key'] }}" - when: - - item['value']['bigboot_execute_bigboot'] | bool + vars_files: + - bigboot_vars.yml + + tasks: + - name: ReaR backup per host + ansible.builtin.import_role: + name: rhc.rear.rear_backup + vars: + client_ips: "{{ item['value']['bigboot_size'] }}" + namehost: "{{ item['key'] }}" + loop: "{{ bigboot_data | dict2items }}" + loop_control: + label: "{{ item['key'] }}" + when: + - item['value']['bigboot_execute_bigboot'] | bool + - not bigboot_rear_backup_skip | default(false) | bool -- 2.47.1 From fd108e2b69b5b0f1c2736ef602b2fd8619ea090b Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 26 Jul 2024 11:40:03 -0400 Subject: [PATCH 11/32] import->include --- bigboot_rear_backup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigboot_rear_backup.yml b/bigboot_rear_backup.yml index a53060d..c03a459 100644 --- a/bigboot_rear_backup.yml +++ b/bigboot_rear_backup.yml @@ -10,7 +10,7 @@ tasks: - name: ReaR backup per host - ansible.builtin.import_role: + ansible.builtin.include_role: name: rhc.rear.rear_backup vars: client_ips: "{{ item['value']['bigboot_size'] }}" -- 2.47.1 From d7c73f1a970e405fbc49bd82c67d5f0e690e108c Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 26 Jul 2024 14:12:10 -0400 Subject: [PATCH 12/32] refactor --- bigboot_rear_backup.yml | 27 +++++---------------------- bigboot_rear_nfs_export.yml | 19 +++++++++++++++++++ bigboot_setup_environment.yml | 12 +++--------- tasks/rear_nfs_exports.yml | 9 +++++++++ 4 files changed, 36 insertions(+), 31 deletions(-) create mode 100644 bigboot_rear_nfs_export.yml create mode 100644 tasks/rear_nfs_exports.yml diff --git a/bigboot_rear_backup.yml b/bigboot_rear_backup.yml index c03a459..8b98be9 100644 --- a/bigboot_rear_backup.yml +++ b/bigboot_rear_backup.yml @@ -1,23 +1,6 @@ --- -- 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: ReaR backup per host - ansible.builtin.include_role: - name: rhc.rear.rear_backup - vars: - client_ips: "{{ item['value']['bigboot_size'] }}" - namehost: "{{ item['key'] }}" - loop: "{{ bigboot_data | dict2items }}" - loop_control: - label: "{{ item['key'] }}" - when: - - item['value']['bigboot_execute_bigboot'] | bool - - not bigboot_rear_backup_skip | default(false) | bool +- name: Perform a ReaR backup before the /boot expansion + ansible.builtin.import_playbook: rhc.rear.rear_backup + when: + - bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool + - not bigboot_rear_backup_skip | default(false) | bool diff --git a/bigboot_rear_nfs_export.yml b/bigboot_rear_nfs_export.yml new file mode 100644 index 0000000..9ce1f77 --- /dev/null +++ b/bigboot_rear_nfs_export.yml @@ -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'] | bool + - not bigboot_rear_backup_skip | default(false) | bool + diff --git a/bigboot_setup_environment.yml b/bigboot_setup_environment.yml index 16968cf..1bb86b6 100644 --- a/bigboot_setup_environment.yml +++ b/bigboot_setup_environment.yml @@ -40,7 +40,9 @@ '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, + 'ip_addresses': ansible_all_ipv4_addresses, + 'server_hostname': ansible_hostname } }) }}" @@ -52,12 +54,4 @@ - ansible_facts['services'][bigboot_docker_service] is defined - ansible_facts['services'][bigboot_docker_service]['state'] == "running" - -- name: Perform a ReaR backup if any disk modifications are to be made - ansible.builtin.import_playbook: rhc.rear.rear_backup - when: - - bigboot_execute_shrink_lv | default(false) | bool - or bigboot_execute_bigboot | default(false) | bool - - not rear_backup_skip | default(false) | bool - ... diff --git a/tasks/rear_nfs_exports.yml b/tasks/rear_nfs_exports.yml new file mode 100644 index 0000000..8c5403b --- /dev/null +++ b/tasks/rear_nfs_exports.yml @@ -0,0 +1,9 @@ +--- +- name: Create list of IP addresses and hostnames + ansible.builtin.set_fact: + client_ips: "{{ item['value']['ip_addresses'] }}" + namehost: "{{ item['value']['server_hostname'] }}" + +- name: Include NFS export role + ansible.builtin.include_role: + name: rhc.rear.say_hi -- 2.47.1 From 22d4c220ab291199b5da76668b3c0603acab63bd Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 26 Jul 2024 14:16:28 -0400 Subject: [PATCH 13/32] fix hosts --- bigboot_rear_nfs_export.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigboot_rear_nfs_export.yml b/bigboot_rear_nfs_export.yml index 9ce1f77..a0a7e7d 100644 --- a/bigboot_rear_nfs_export.yml +++ b/bigboot_rear_nfs_export.yml @@ -1,6 +1,6 @@ --- - name: Perform logical volume and boot parition resizing as needed - hosts: rear-server + hosts: rear_server become: true gather_facts: false -- 2.47.1 From 050939b52a542b515d7ad29c4637a87bb75c8e4f Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 26 Jul 2024 15:42:23 -0400 Subject: [PATCH 14/32] add default --- bigboot_rear_nfs_export.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigboot_rear_nfs_export.yml b/bigboot_rear_nfs_export.yml index a0a7e7d..780c7ef 100644 --- a/bigboot_rear_nfs_export.yml +++ b/bigboot_rear_nfs_export.yml @@ -14,6 +14,6 @@ loop_control: label: "{{ item['key'] }}" when: - - item['value']['bigboot_execute_bigboot'] | bool + - item['value']['bigboot_execute_bigboot'] | default(false) | bool - not bigboot_rear_backup_skip | default(false) | bool -- 2.47.1 From 42709c4fe6f7cb889ae041f270d6149d1e554093 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 26 Jul 2024 15:51:34 -0400 Subject: [PATCH 15/32] variable naming fix --- bigboot_rear_backup.yml | 2 +- bigboot_rear_nfs_export.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bigboot_rear_backup.yml b/bigboot_rear_backup.yml index 8b98be9..27e1b10 100644 --- a/bigboot_rear_backup.yml +++ b/bigboot_rear_backup.yml @@ -3,4 +3,4 @@ ansible.builtin.import_playbook: rhc.rear.rear_backup when: - bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool - - not bigboot_rear_backup_skip | default(false) | bool + - not rear_backup_skip | default(false) | bool diff --git a/bigboot_rear_nfs_export.yml b/bigboot_rear_nfs_export.yml index 780c7ef..e521e42 100644 --- a/bigboot_rear_nfs_export.yml +++ b/bigboot_rear_nfs_export.yml @@ -15,5 +15,5 @@ label: "{{ item['key'] }}" when: - item['value']['bigboot_execute_bigboot'] | default(false) | bool - - not bigboot_rear_backup_skip | default(false) | bool + - not rear_backup_skip | default(false) | bool -- 2.47.1 From 205101856bc72cd4b2a8301ca750ba3ded72039f Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 26 Jul 2024 15:55:40 -0400 Subject: [PATCH 16/32] add filters --- tasks/rear_nfs_exports.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/rear_nfs_exports.yml b/tasks/rear_nfs_exports.yml index 8c5403b..c1013e2 100644 --- a/tasks/rear_nfs_exports.yml +++ b/tasks/rear_nfs_exports.yml @@ -1,7 +1,7 @@ --- - name: Create list of IP addresses and hostnames ansible.builtin.set_fact: - client_ips: "{{ item['value']['ip_addresses'] }}" + client_ips: "{{ item['value']['ip_addresses'] | list | flatten }}" namehost: "{{ item['value']['server_hostname'] }}" - name: Include NFS export role -- 2.47.1 From f655d1971622a91696491e31be44ce3a22a70f90 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Mon, 29 Jul 2024 16:08:33 -0400 Subject: [PATCH 17/32] fixes --- bigboot_execute_resize.yml | 11 ----------- bigboot_setup_environment.yml | 8 ++++---- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/bigboot_execute_resize.yml b/bigboot_execute_resize.yml index 664ac97..87edf51 100644 --- a/bigboot_execute_resize.yml +++ b/bigboot_execute_resize.yml @@ -74,17 +74,6 @@ when: - 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: name: "{{ item }}" diff --git a/bigboot_setup_environment.yml b/bigboot_setup_environment.yml index 1bb86b6..8539e65 100644 --- a/bigboot_setup_environment.yml +++ b/bigboot_setup_environment.yml @@ -12,21 +12,21 @@ - name: Cleanup from any previous executions ansible.builtin.import_tasks: tasks/cleanup.yml - - name: Get the list of services on the host + - name: Ensure service facts are available ansible.builtin.service_facts: - name: Stop Docker service due to incompatibility ansible.builtin.service: - name: docker.service + name: "{{ bigboot_docker_service }}" state: stopped when: - ansible_facts['services'][bigboot_docker_service] is defined - ansible_facts['services'][bigboot_docker_service]['state'] == "running" - - 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 environment for subsequent workflow nodes -- 2.47.1 From 664291b15df8f4a8dfcb142036c45d893663188e Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 30 Jul 2024 17:16:57 -0400 Subject: [PATCH 18/32] Support for logging of disabled services --- tasks/check_systemd_services.yml | 8 ++++++++ tasks/cleanup.yml | 12 ++++++++++++ tasks/disable_systemd_services.yml | 10 ++++++++++ vars/bigboot_vars.yml | 3 +++ 4 files changed, 33 insertions(+) diff --git a/tasks/check_systemd_services.yml b/tasks/check_systemd_services.yml index 2c29381..3bc7c63 100644 --- a/tasks/check_systemd_services.yml +++ b/tasks/check_systemd_services.yml @@ -29,3 +29,11 @@ when: - item['item'] not in bigboot_protected_services - item['stdout'] | regex_replace('^.*=(.*$)', '\\1') | community.general.to_minutes > bigboot_service_max_timeout + +- name: Log list of disabled services + ansible.builtin.copy: + content: "{{ bigboot_systemd_disabled_services }}" + dest: "{{ bigboot_disabled_services_log }}" + owner: root + group: root + mode: "0600" diff --git a/tasks/cleanup.yml b/tasks/cleanup.yml index 222f0e0..1c73a97 100644 --- a/tasks/cleanup.yml +++ b/tasks/cleanup.yml @@ -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 + ... diff --git a/tasks/disable_systemd_services.yml b/tasks/disable_systemd_services.yml index d90a9f4..119c2b1 100644 --- a/tasks/disable_systemd_services.yml +++ b/tasks/disable_systemd_services.yml @@ -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 }}" + create: true + state: present + owner: root + group: root + mode: "0600" diff --git a/vars/bigboot_vars.yml b/vars/bigboot_vars.yml index 4f7074d..0b111e3 100644 --- a/vars/bigboot_vars.yml +++ b/vars/bigboot_vars.yml @@ -22,3 +22,6 @@ bigboot_protected_services: - rhnsd.service - rhnsd - boksm.service + +# Filename of disabled services log: +bigboot_disabled_services_log: /var/ipe/ipu/bigboot-disabled-services -- 2.47.1 From 64f1220935b31205e9f9d916b75cfbe4319bc470 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 30 Jul 2024 17:23:20 -0400 Subject: [PATCH 19/32] That task wasnt supposed to be there! --- tasks/check_systemd_services.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tasks/check_systemd_services.yml b/tasks/check_systemd_services.yml index 3bc7c63..2c29381 100644 --- a/tasks/check_systemd_services.yml +++ b/tasks/check_systemd_services.yml @@ -29,11 +29,3 @@ when: - item['item'] not in bigboot_protected_services - item['stdout'] | regex_replace('^.*=(.*$)', '\\1') | community.general.to_minutes > bigboot_service_max_timeout - -- name: Log list of disabled services - ansible.builtin.copy: - content: "{{ bigboot_systemd_disabled_services }}" - dest: "{{ bigboot_disabled_services_log }}" - owner: root - group: root - mode: "0600" -- 2.47.1 From b7b6f9555dd9ff017f8c188d4bf932a21d6e4c0a Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 30 Jul 2024 17:25:52 -0400 Subject: [PATCH 20/32] Indent fix. --- tasks/cleanup.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks/cleanup.yml b/tasks/cleanup.yml index 1c73a97..da3e2c1 100644 --- a/tasks/cleanup.yml +++ b/tasks/cleanup.yml @@ -34,11 +34,11 @@ 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 +- 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 ... -- 2.47.1 From 94c4366903b74a44b163f8413429b0b515d77385 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 30 Jul 2024 17:27:39 -0400 Subject: [PATCH 21/32] Indent fix. Yes, again. --- tasks/cleanup.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/cleanup.yml b/tasks/cleanup.yml index da3e2c1..180e5be 100644 --- a/tasks/cleanup.yml +++ b/tasks/cleanup.yml @@ -29,10 +29,10 @@ 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: 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: -- 2.47.1 From b440005e55d50cf7d2249e1905f3bf5bee57eabf Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 30 Jul 2024 17:31:12 -0400 Subject: [PATCH 22/32] Var fix. --- tasks/disable_systemd_services.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/disable_systemd_services.yml b/tasks/disable_systemd_services.yml index 119c2b1..5356484 100644 --- a/tasks/disable_systemd_services.yml +++ b/tasks/disable_systemd_services.yml @@ -13,7 +13,7 @@ - name: Log disabled service to log file ansible.builtin.lineinfile: path: "{{ bigboot_disabled_services_log }}" - line: "{{ item }}" + line: "{{ item['item'] }}" create: true state: present owner: root -- 2.47.1 From fad845dd1ded1da9dff817a1aa2c5e41c3e83496 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 30 Jul 2024 17:48:03 -0400 Subject: [PATCH 23/32] =?UTF-8?q?Doing=20the=20task=20shuffle.=20=C2=AF\?= =?UTF-8?q?=5F(=E3=83=84)=5F/=C2=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bigboot_execute_resize.yml | 8 ++++++++ bigboot_setup_environment.yml | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bigboot_execute_resize.yml b/bigboot_execute_resize.yml index 87edf51..4bfc6a1 100644 --- a/bigboot_execute_resize.yml +++ b/bigboot_execute_resize.yml @@ -83,3 +83,11 @@ when: - bigboot_systemd_disabled_services is defined - bigboot_systemd_disabled_services | length > 0 + + - name: Restore Docker service to its previous running state + ansible.builtin.service: + name: docker.service + state: started + when: + - ansible_facts['services'][bigboot_docker_service] is defined + - ansible_facts['services'][bigboot_docker_service]['state'] == "running" diff --git a/bigboot_setup_environment.yml b/bigboot_setup_environment.yml index 8539e65..05d030b 100644 --- a/bigboot_setup_environment.yml +++ b/bigboot_setup_environment.yml @@ -46,12 +46,4 @@ } }) }}" - - name: Restore Docker service to its previous running state - ansible.builtin.service: - name: docker.service - state: started - when: - - ansible_facts['services'][bigboot_docker_service] is defined - - ansible_facts['services'][bigboot_docker_service]['state'] == "running" - ... -- 2.47.1 From 4ca8d421e290378bb671144cf38dadf39055b80a Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Tue, 30 Jul 2024 18:05:08 -0400 Subject: [PATCH 24/32] =?UTF-8?q?More=20shufflin=20=C2=AF\=5F(=E3=83=84)?= =?UTF-8?q?=5F/=C2=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bigboot_execute_resize.yml | 37 ++++++++++++++--------------------- bigboot_setup_environment.yml | 12 ++---------- tasks/stop_docker_service.yml | 11 +++++++++++ 3 files changed, 28 insertions(+), 32 deletions(-) create mode 100644 tasks/stop_docker_service.yml diff --git a/bigboot_execute_resize.yml b/bigboot_execute_resize.yml index 4bfc6a1..72aaf36 100644 --- a/bigboot_execute_resize.yml +++ b/bigboot_execute_resize.yml @@ -14,20 +14,6 @@ - (bigboot_data[inventory_hostname]['bigboot_execute_shrink_lv'] | default(false) | bool or 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 | list | 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 @@ -48,6 +34,21 @@ - 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: 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 + + - name: Stop Docker service if present and running + ansible.builtin.import_tasks: tasks/stop_docker_service.yml + - name: Extend the timeout values for physical hosts ansible.builtin.set_fact: @@ -83,11 +84,3 @@ when: - bigboot_systemd_disabled_services is defined - bigboot_systemd_disabled_services | length > 0 - - - name: Restore Docker service to its previous running state - ansible.builtin.service: - name: docker.service - state: started - when: - - ansible_facts['services'][bigboot_docker_service] is defined - - ansible_facts['services'][bigboot_docker_service]['state'] == "running" diff --git a/bigboot_setup_environment.yml b/bigboot_setup_environment.yml index 05d030b..5acc561 100644 --- a/bigboot_setup_environment.yml +++ b/bigboot_setup_environment.yml @@ -12,16 +12,8 @@ - name: Cleanup from any previous executions ansible.builtin.import_tasks: tasks/cleanup.yml - - name: Ensure service facts are available - ansible.builtin.service_facts: - - - name: Stop Docker service due to incompatibility - ansible.builtin.service: - name: "{{ bigboot_docker_service }}" - state: stopped - when: - - ansible_facts['services'][bigboot_docker_service] is defined - - ansible_facts['services'][bigboot_docker_service]['state'] == "running" + - name: Stop Docker service if present and running + ansible.builtin.import_tasks: tasks/stop_docker_service.yml - name: Set boot device details ansible.builtin.import_tasks: tasks/capture_boot_device_details.yml diff --git a/tasks/stop_docker_service.yml b/tasks/stop_docker_service.yml new file mode 100644 index 0000000..69fce68 --- /dev/null +++ b/tasks/stop_docker_service.yml @@ -0,0 +1,11 @@ +--- +- name: Ensure service facts are available + ansible.builtin.service_facts: + +- name: Stop Docker service due to incompatibility + ansible.builtin.service: + name: "{{ bigboot_docker_service }}" + state: stopped + when: + - ansible_facts['services'][bigboot_docker_service] is defined + - ansible_facts['services'][bigboot_docker_service]['state'] == "running" -- 2.47.1 From 0b115970386feb80a092d8951cad3eced65b705e Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Wed, 31 Jul 2024 10:03:36 -0400 Subject: [PATCH 25/32] Logic prune --- bigboot_execute_resize.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bigboot_execute_resize.yml b/bigboot_execute_resize.yml index 72aaf36..13daff3 100644 --- a/bigboot_execute_resize.yml +++ b/bigboot_execute_resize.yml @@ -11,8 +11,7 @@ tasks: - name: Perform service and filesystem checks prior to Bigboot execution when: - - (bigboot_data[inventory_hostname]['bigboot_execute_shrink_lv'] | default(false) | bool - or bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool) + - bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool block: - name: Enable Grub filesystem check ansible.builtin.import_role: -- 2.47.1 From e53e97cf9a3abd74dd0f9a77bc7514f08bf11389 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Wed, 31 Jul 2024 11:53:25 -0400 Subject: [PATCH 26/32] Fix Docker service management; relocate Grub fsck --- bigboot_execute_resize.yml | 32 ++++++++++---------------------- bigboot_setup_environment.yml | 4 +++- tasks/grub_filesystem_check.yml | 20 ++++++++++++++++++++ tasks/stop_docker_service.yml | 17 +++++++++++++++++ vars/bigboot_vars.yml | 2 ++ 5 files changed, 52 insertions(+), 23 deletions(-) create mode 100644 tasks/grub_filesystem_check.yml diff --git a/bigboot_execute_resize.yml b/bigboot_execute_resize.yml index 13daff3..103ddab 100644 --- a/bigboot_execute_resize.yml +++ b/bigboot_execute_resize.yml @@ -13,25 +13,8 @@ when: - bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | 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: Perform filesystem check prior to Bigboot execution + ansible.builtin.import_tasks: tasks/grub_filesystem_check.yml - name: Check for and disable services exceeding the timeout threshold ansible.builtin.import_tasks: tasks/check_systemd_services.yml @@ -45,9 +28,6 @@ - bigboot_systemd_disabled_services is defined - bigboot_systemd_disabled_services | length > 0 - - name: Stop Docker service if present and running - ansible.builtin.import_tasks: tasks/stop_docker_service.yml - - name: Extend the timeout values for physical hosts ansible.builtin.set_fact: @@ -74,6 +54,14 @@ when: - bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | bool + - name: Restore Docker service to its pre-Bigboot state + ansible.builtin.service: + name: "{{ bigboot_docker_service }}" + state: "{{ bigboot_data[inventory_hostname]['bigboot_docker_running'] }}" + enabled: "{{ bigboot_data[inventory_hostname]['bigboot_docker_enabled'] }}" + when: + - ansible_facts['services'][bigboot_docker_service] is defined + - name: Re-enabling services previously disabled ansible.builtin.service: name: "{{ item }}" diff --git a/bigboot_setup_environment.yml b/bigboot_setup_environment.yml index 5acc561..05aa168 100644 --- a/bigboot_setup_environment.yml +++ b/bigboot_setup_environment.yml @@ -12,7 +12,7 @@ - name: Cleanup from any previous executions ansible.builtin.import_tasks: tasks/cleanup.yml - - name: Stop Docker service if present and running + - name: Stop and disable the Docker service if present and running ansible.builtin.import_tasks: tasks/stop_docker_service.yml - name: Set boot device details @@ -33,6 +33,8 @@ 'bigboot_adjacent_lvm_device': bigboot_adjacent_lvm_device, 'bigboot_lv_shrink_size': bigboot_lv_shrink_size | int, '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 } diff --git a/tasks/grub_filesystem_check.yml b/tasks/grub_filesystem_check.yml new file mode 100644 index 0000000..cdff1a1 --- /dev/null +++ b/tasks/grub_filesystem_check.yml @@ -0,0 +1,20 @@ +--- +- 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 diff --git a/tasks/stop_docker_service.yml b/tasks/stop_docker_service.yml index 69fce68..e561bba 100644 --- a/tasks/stop_docker_service.yml +++ b/tasks/stop_docker_service.yml @@ -2,10 +2,27 @@ - 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: Stop Docker service due to incompatibility ansible.builtin.service: name: "{{ bigboot_docker_service }}" state: stopped + enabled: false when: - ansible_facts['services'][bigboot_docker_service] is defined - ansible_facts['services'][bigboot_docker_service]['state'] == "running" diff --git a/vars/bigboot_vars.yml b/vars/bigboot_vars.yml index 0b111e3..51c2f55 100644 --- a/vars/bigboot_vars.yml +++ b/vars/bigboot_vars.yml @@ -9,6 +9,8 @@ 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 -- 2.47.1 From a8fdf951c4e141369cddf976325c5267e78f9091 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Wed, 31 Jul 2024 12:12:56 -0400 Subject: [PATCH 27/32] Task file re-name --- bigboot_setup_environment.yml | 2 +- tasks/{stop_docker_service.yml => disable_docker_service.yml} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tasks/{stop_docker_service.yml => disable_docker_service.yml} (100%) diff --git a/bigboot_setup_environment.yml b/bigboot_setup_environment.yml index 05aa168..43cddbe 100644 --- a/bigboot_setup_environment.yml +++ b/bigboot_setup_environment.yml @@ -13,7 +13,7 @@ ansible.builtin.import_tasks: tasks/cleanup.yml - name: Stop and disable the Docker service if present and running - ansible.builtin.import_tasks: tasks/stop_docker_service.yml + ansible.builtin.import_tasks: tasks/disable_docker_service.yml - name: Set boot device details ansible.builtin.import_tasks: tasks/capture_boot_device_details.yml diff --git a/tasks/stop_docker_service.yml b/tasks/disable_docker_service.yml similarity index 100% rename from tasks/stop_docker_service.yml rename to tasks/disable_docker_service.yml -- 2.47.1 From 490170e7526d03bba75c52cbe2a78a5c96a8dbfa Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Wed, 31 Jul 2024 12:28:58 -0400 Subject: [PATCH 28/32] Task shift --- tasks/disable_docker_service.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tasks/disable_docker_service.yml b/tasks/disable_docker_service.yml index e561bba..8d7ee54 100644 --- a/tasks/disable_docker_service.yml +++ b/tasks/disable_docker_service.yml @@ -18,11 +18,8 @@ when: - ansible_facts['services'][bigboot_docker_service]['status'] == "enabled" -- name: Stop Docker service due to incompatibility - ansible.builtin.service: - name: "{{ bigboot_docker_service }}" - state: stopped - enabled: false - when: - - ansible_facts['services'][bigboot_docker_service] is defined - - ansible_facts['services'][bigboot_docker_service]['state'] == "running" + - name: Ensure Docker service is stopped and disabled + ansible.builtin.service: + name: "{{ bigboot_docker_service }}" + state: stopped + enabled: false -- 2.47.1 From 8245abf806404c28fd33f71543a2bd1c71e1bef0 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Wed, 31 Jul 2024 23:29:03 -0400 Subject: [PATCH 29/32] Fix conditional; cant check string against integer --- tasks/check_systemd_services.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/check_systemd_services.yml b/tasks/check_systemd_services.yml index 2c29381..5ecbe26 100644 --- a/tasks/check_systemd_services.yml +++ b/tasks/check_systemd_services.yml @@ -28,4 +28,4 @@ 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 -- 2.47.1 From 339dcdd6ad83e082f2bf417b825b1d1658fb2077 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 1 Aug 2024 10:13:25 -0400 Subject: [PATCH 30/32] Task reorder/move; log path update --- bigboot_execute_resize.yml | 13 ++----------- tasks/check_systemd_services.yml | 9 +++++++++ vars/bigboot_vars.yml | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bigboot_execute_resize.yml b/bigboot_execute_resize.yml index 103ddab..8492318 100644 --- a/bigboot_execute_resize.yml +++ b/bigboot_execute_resize.yml @@ -13,20 +13,11 @@ when: - bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool block: - - name: Perform filesystem check prior to Bigboot execution - ansible.builtin.import_tasks: tasks/grub_filesystem_check.yml - - 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 | join(',') }} - when: - - bigboot_systemd_disabled_services is defined - - bigboot_systemd_disabled_services | length > 0 + - 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 diff --git a/tasks/check_systemd_services.yml b/tasks/check_systemd_services.yml index 5ecbe26..558c23e 100644 --- a/tasks/check_systemd_services.yml +++ b/tasks/check_systemd_services.yml @@ -29,3 +29,12 @@ when: - item['item'] not in bigboot_protected_services - 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 diff --git a/vars/bigboot_vars.yml b/vars/bigboot_vars.yml index 51c2f55..b506917 100644 --- a/vars/bigboot_vars.yml +++ b/vars/bigboot_vars.yml @@ -26,4 +26,4 @@ bigboot_protected_services: - boksm.service # Filename of disabled services log: -bigboot_disabled_services_log: /var/ipe/ipu/bigboot-disabled-services +bigboot_disabled_services_log: /root/bigboot_disabled_services.log -- 2.47.1 From 782aa942106ecc8f70605d20522ef716ab9a9622 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 1 Aug 2024 10:41:45 -0400 Subject: [PATCH 31/32] Add reboot code to match scneario --- tasks/grub_filesystem_check.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tasks/grub_filesystem_check.yml b/tasks/grub_filesystem_check.yml index cdff1a1..a1ee48d 100644 --- a/tasks/grub_filesystem_check.yml +++ b/tasks/grub_filesystem_check.yml @@ -4,17 +4,27 @@ name: autofsck tasks_from: main.yml -- name: Flush handlers +- 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.reboot: + 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 +- name: Flush handlers to remove Grub parameters for fsck ansible.builtin.meta: flush_handlers -- 2.47.1 From 27d5965e82978b45451f6bab85d669d6c195d57a Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 1 Aug 2024 10:55:04 -0400 Subject: [PATCH 32/32] Add service fact gathering --- bigboot_execute_resize.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bigboot_execute_resize.yml b/bigboot_execute_resize.yml index 8492318..bc85ddb 100644 --- a/bigboot_execute_resize.yml +++ b/bigboot_execute_resize.yml @@ -45,6 +45,9 @@ when: - bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | bool + - name: Ensure service facts are available + ansible.builtin.service_facts: + - name: Restore Docker service to its pre-Bigboot state ansible.builtin.service: name: "{{ bigboot_docker_service }}" -- 2.47.1