From bd8b57cac37ba789d1025645ac4ad9ed96cb9bde Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 5 Dec 2024 16:59:00 +0100 Subject: [PATCH 1/8] sap_ha_pacemaker_cluster:[feat] enable RHEL pre-steps for resource agent package detection --- .../tasks/RedHat/pre_steps_hana.yml | 52 +++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_hana.yml b/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_hana.yml index f4b0dd297..52aeff021 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_hana.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_hana.yml @@ -1,7 +1,51 @@ # SPDX-License-Identifier: Apache-2.0 --- -# Identify if SAPHanaSR-angi package is available for installation. -# SAPHanaSR-angi replaces SAPHanaSR and SAPHanaSR-ScaleOut. +# Identify if 'sap-hana-ha' package is available for installation. +# sap-hana-ha replaces resource-agents-sap-hana and resource-agents-sap-hana-scaleout. -# TODO: -# Add RedHat specific steps to identify SAPHanaSR-angi package. +- name: "SAP HA Prepare Pacemaker - Block for detection of 'SAPHanaSR-angi'" + when: (sap_ha_pacemaker_cluster_saphanasr_angi_detection | bool) + block: + + - name: "SAP HA Prepare Pacemaker - Gather installed packages facts" + ansible.builtin.package_facts: + manager: auto + + - name: "SAP HA Prepare Pacemaker - Check the availability of 'sap-hana-ha'" + ansible.builtin.command: + cmd: dnf provides sap-hana-ha + changed_when: false + register: __sap_ha_pacemaker_cluster_saphanasr_angi_check + failed_when: false + + # The provision role should not fix packages if run against systems that + # were previously installed with the conflicting packages. System state is + # unclear at this moment and the role should rather fail early. + - name: "SAP HA Prepare Pacemaker - Fail if there are package conflicts" + ansible.builtin.assert: + that: + - "'resource-agents-sap-hana' not in packages or + __sap_ha_pacemaker_cluster_saphanasr_angi_check.rc == 0" + fail_msg: | + + ERROR: Conflicting packages. + + Package available and to be installed: sap-hana-ha + + Conflicting packages are installed: + {% for finding in (packages | select('match', 'resource-agents-sap.*')) %} + - {{ finding }} + {% endfor %} + + Remove the conflicting packages to continue the setup with the + detected resource agent package. + Alternatively: Disable the package detection + (sap_ha_pacemaker_cluster_saphanasr_angi_detection = false) + to continue the setup using the installed resource agents. + + - name: "SAP HA Prepare Pacemaker - Set fact angi_available" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_saphanasr_angi_available: true + when: + - __sap_ha_pacemaker_cluster_saphanasr_angi_check is defined + - __sap_ha_pacemaker_cluster_saphanasr_angi_check.rc == 0 From 801303dc48b609c04bccebb25487631cf7eff64d Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 5 Dec 2024 18:11:25 +0100 Subject: [PATCH 2/8] sap_ha_pacemaker_cluster:(fix) improved task names --- roles/sap_ha_pacemaker_cluster/tasks/configure_srhook.yml | 4 ++-- .../tasks/platform/ascertain_platform_type.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/configure_srhook.yml b/roles/sap_ha_pacemaker_cluster/tasks/configure_srhook.yml index aac210639..9acfe096d 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/configure_srhook.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/configure_srhook.yml @@ -26,14 +26,14 @@ __sap_ha_pacemaker_cluster_hana_hook_chksrv: false # tkover and chksrv variables are updated if their providers are detected - - name: "SAP HA Pacemaker srHook - Set tkover true if present" + - name: "SAP HA Pacemaker srHook - Set tkover true if defined and enabled" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_hana_hook_tkover: true when: - sap_ha_pacemaker_cluster_hana_hooks | selectattr( 'provider', 'search', 'tkover', 'i') | list | length > 0 - - name: "SAP HA Pacemaker srHook - Set chksrv true if present" + - name: "SAP HA Pacemaker srHook - Set chksrv true if defined and enabled" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_hana_hook_chksrv: true when: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml index 4ebd242bd..4cf7b2ef2 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml @@ -81,14 +81,14 @@ changed_when: false when: ansible_architecture == "ppc64le" -- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power - RSCT binary check" +- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power - Fail if RSCT binary is missing" ansible.builtin.fail: msg: Please install RSCT from IBM Power Systems service and productivity tools repository when: - ansible_architecture == "ppc64le" - __sap_ha_pacemaker_cluster_power_rsct_check.stdout == "" -- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power - RSCT binary check" +- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power - Run 'ctgethscid'" ansible.builtin.shell: | /opt/rsct/bin/ctgethscid register: __sap_ha_pacemaker_cluster_power_rsct_hscid From 15eb813cc9c3a1fcd647a409bf80e0dbe2e82201 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 5 Dec 2024 18:45:17 +0100 Subject: [PATCH 3/8] sap_ha_pacemaker_cluster:(fix) correct default hanacontroller clone name as per comment in defaults/main.yml --- roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml index cf7d537da..172a7d0da 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml @@ -3,7 +3,7 @@ # Detect presence of SAPHanaSR-angi package before loading HANA variables # Detection of package availability was chosen instead of OS version check. # SAPHanaSR-angi will be retrofitted to older SP repositories in future. -- name: "SAP HA Prepare Pacemaker - Detect SAPHanaSR-angi availability" +- name: "SAP HA Install Pacemaker - Run SAP HANA pre-steps" ansible.builtin.include_tasks: file: "{{ ansible_facts['os_family'] }}/pre_steps_hana.yml" when: @@ -81,7 +81,7 @@ else sap_ha_pacemaker_cluster_hanacontroller_resource_name }}" __sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name: - "{{ 'mst_SAPHanaCon_' ~ __sap_ha_pacemaker_cluster_hana_sid ~ '_HDB' ~ __sap_ha_pacemaker_cluster_hana_instance_nr + "{{ 'cln_SAPHanaCon_' ~ __sap_ha_pacemaker_cluster_hana_sid ~ '_HDB' ~ __sap_ha_pacemaker_cluster_hana_instance_nr if sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name | string | length == 0 else sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name }}" From e910e4d3d17ff608e74744ff04a9568d489c3630 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 5 Dec 2024 18:50:38 +0100 Subject: [PATCH 4/8] sap_ha_pacemaker_cluster:(fix) order constraint use hanacontroller clone when angi is used --- .../tasks/construct_vars_vip_constraints_hana.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml index 5c1681fad..a7fabc31b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml @@ -9,7 +9,9 @@ __constraint_order_vip: id: "{{ __sap_ha_pacemaker_cluster_hana_order_hana_vip_primary_name }}" resource_first: - id: "{{ __sap_ha_pacemaker_cluster_hana_resource_clone_name }}" + id: "{{ __sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name + if __sap_ha_pacemaker_cluster_saphanasr_angi_available + else __sap_ha_pacemaker_cluster_hana_resource_clone_name }}" action: promote resource_then: id: "{{ __res_or_grp }}" @@ -48,7 +50,9 @@ __constraint_order_vip: id: "{{ __sap_ha_pacemaker_cluster_hana_order_hana_vip_secondary_name }}" resource_first: - id: "{{ __sap_ha_pacemaker_cluster_hana_resource_clone_name }}" + id: "{{ __sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name + if __sap_ha_pacemaker_cluster_saphanasr_angi_available + else __sap_ha_pacemaker_cluster_hana_resource_clone_name }}" action: start resource_then: id: "{{ __res_or_grp }}" From 286fa45397390a7a19d514829d14dd39cbb0eb12 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 5 Dec 2024 19:09:58 +0100 Subject: [PATCH 5/8] sap_ha_pacemaker_cluster:(fix) allow user override which hooks to enable while using the OS default hook list --- .../vars/hana_scaleup_perf.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_perf.yml b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_perf.yml index d471f5f73..d43b3905c 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_perf.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_perf.yml @@ -20,11 +20,15 @@ __sap_ha_pacemaker_cluster_hana_hook_dictionary: # Recommended srhooks are set to true only if default dictionary is populated __sap_ha_pacemaker_cluster_hana_hook_tkover: - "{{ true if lookup('ansible.builtin.vars', __sap_ha_pacemaker_cluster_hana_hook_dictionary).tkover - is defined else false }}" + "{{ true if + (lookup('ansible.builtin.vars', __sap_ha_pacemaker_cluster_hana_hook_dictionary).tkover + is defined and (sap_ha_pacemaker_cluster_hana_hook_tkover | bool)) + else false }}" __sap_ha_pacemaker_cluster_hana_hook_chksrv: - "{{ true if lookup('ansible.builtin.vars', __sap_ha_pacemaker_cluster_hana_hook_dictionary).chksrv - is defined else false }}" + "{{ true if + (lookup('ansible.builtin.vars', __sap_ha_pacemaker_cluster_hana_hook_dictionary).chksrv + is defined and (sap_ha_pacemaker_cluster_hana_hook_chksrv | bool)) + else false }}" # Combine final list of srhooks based on user input and angi availability __sap_ha_pacemaker_cluster_hana_hooks: "{{ From fd58040bc68cc1bff6ad5816fc714ed41a49fab3 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 5 Dec 2024 19:12:29 +0100 Subject: [PATCH 6/8] sap_ha_pacemaker_cluster: enable SUSE recommended hooks by OS default --- roles/sap_ha_pacemaker_cluster/vars/suse.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/sap_ha_pacemaker_cluster/vars/suse.yml b/roles/sap_ha_pacemaker_cluster/vars/suse.yml index e8fe64ee8..582e9f9da 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/suse.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/suse.yml @@ -132,5 +132,9 @@ __sap_ha_pacemaker_cluster_hook_hana_scaleup_perf_angi: __sap_ha_pacemaker_cluster_hook_hana_scaleout: [] __sap_ha_pacemaker_cluster_hook_hana_scaleout_angi: [] +# Enable default OS recommended hooks +sap_ha_pacemaker_cluster_hana_hook_tkover: true +sap_ha_pacemaker_cluster_hana_hook_chksrv: true + # Central Services Cluster Simple Mount: Enabled as default sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount: true From 65d4b4a47d93a2abd86604c5b4c2679f33b93f08 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 5 Dec 2024 19:14:04 +0100 Subject: [PATCH 7/8] sap_ha_pacemaker_cluster: RHEL enablement of default hooks and angi --- .../sap_ha_pacemaker_cluster/vars/redhat.yml | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/vars/redhat.yml b/roles/sap_ha_pacemaker_cluster/vars/redhat.yml index 569c91c30..d3d1a0f57 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/redhat.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/redhat.yml @@ -91,6 +91,8 @@ __sap_ha_pacemaker_cluster_platform_extra_packages_dict: # Dictionary with additional cluster packages for specific scenarios __sap_ha_pacemaker_cluster_sap_extra_packages_dict: + hana_angi: + - sap-hana-ha hana_scaleout: - resource-agents-sap-hana-scaleout hana_scaleup: @@ -105,13 +107,10 @@ __sap_ha_pacemaker_cluster_sap_extra_packages_dict: __sap_ha_pacemaker_cluster_resource_agents: saphanatopology: "ocf:heartbeat:SAPHanaTopology" saphana: "ocf:heartbeat:SAPHana" -# TODO: Uncomment when SAPHanaSR-angi is available on Red Hat -# saphanacontroller: "ocf:heartbeat:SAPHanaController" -# saphanafilesystem: "ocf:heartbeat:SAPHanaFilesystem" -# TODO: Uncomment when SAPStartSrv is available on Red Hat -# sapstartsrv: "ocf:heartbeat:SAPStartSrv" + saphanacontroller: "ocf:heartbeat:SAPHanaController" + saphanafilesystem: "ocf:heartbeat:SAPHanaFilesystem" + sapstartsrv: "ocf:heartbeat:SAPStartSrv" -# TODO: Uncomment when SAPHanaSR-angi is available on Red Hat __sap_ha_pacemaker_cluster_saphanasr_angi_available: false # Default SAP HANA hook parameters combined based on user decision @@ -122,18 +121,39 @@ __sap_ha_pacemaker_cluster_hook_hana_scaleup_perf: options: - name: execution_order value: 1 -# TODO: Add additional hooks + chksrv: + - provider: ChkSrv + path: /usr/share/SAPHanaSR/srHook/ + options: + - name: execution_order + value: 2 + - name: action_on_lost + value: stop + +__sap_ha_pacemaker_cluster_hook_hana_scaleup_perf_angi: + saphanasr: + - provider: HanaSR + path: /usr/share/sap-hana-ha/ + options: + - name: execution_order + value: 1 + chksrv: + - provider: ChkSrv + path: /usr/share/sap-hana-ha/ + options: + - name: execution_order + value: 2 + - name: action_on_lost + value: stop + - name: stop_timeout + value: 25 -# Placeholder dictionaries -# TODO: Define hooks when SAPHanaSR-angi is available on Red Hat -__sap_ha_pacemaker_cluster_hook_hana_scaleup_perf_angi: [] __sap_ha_pacemaker_cluster_hook_hana_scaleout: [] __sap_ha_pacemaker_cluster_hook_hana_scaleout_angi: [] -# Disabled additional hooks until they are present in dictionary above -# TODO: Remove when additional hooks are specified above. -__sap_ha_pacemaker_cluster_hana_hook_tkover: false -__sap_ha_pacemaker_cluster_hana_hook_chksrv: false +# Enable default OS recommended hooks +sap_ha_pacemaker_cluster_hana_hook_tkover: false +sap_ha_pacemaker_cluster_hana_hook_chksrv: true # Central Services Cluster Simple Mount: Enabled as default # TODO: Enable when SAPStartSrv resource agents are available on Red Hat From ffd9ffcfecd20480abc2fa307b8c149f15744338 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 10 Dec 2024 10:58:53 +0100 Subject: [PATCH 8/8] sap_ha_pacemaker_cluster: (fix) hanacontroller clone name prefix per OS --- roles/sap_ha_pacemaker_cluster/defaults/main.yml | 2 +- roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml | 2 +- roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml | 2 +- roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_perf.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 7947b0afe..b50453b94 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -113,7 +113,7 @@ sap_ha_pacemaker_cluster_hana_resource_name: '' # Default: rsc_SAPHa sap_ha_pacemaker_cluster_hana_resource_clone_name: '' # Default: cln_SAPHana__HDB sap_ha_pacemaker_cluster_hana_resource_clone_msl_name: '' # Default: msl_SAPHana__HDB sap_ha_pacemaker_cluster_hanacontroller_resource_name: '' # Default: rsc_SAPHanaCon__HDB -sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name: '' # Default: cln_SAPHanaCon__HDB +sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name: '' # Default: _SAPHanaCon__HDB sap_ha_pacemaker_cluster_hana_topology_resource_name: '' # Default: rsc_SAPHanaTop__HDB sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: '' # Default: cln_SAPHanaTop__HDB sap_ha_pacemaker_cluster_hana_filesystem_resource_name: '' # Default: rsc_SAPHanaFil__HDB diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 0c55ad7b3..7a7e28468 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -427,7 +427,7 @@ argument_specs: - Customize the cluster resource name of the SAP HANA Controller. sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name: - default: "cln_SAPHanaCon__HDB" + default: "_SAPHanaCon__HDB" description: - Customize the cluster resource name of the SAP HANA Controller clone. diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml index 172a7d0da..5ff62e75f 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml @@ -81,7 +81,7 @@ else sap_ha_pacemaker_cluster_hanacontroller_resource_name }}" __sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name: - "{{ 'cln_SAPHanaCon_' ~ __sap_ha_pacemaker_cluster_hana_sid ~ '_HDB' ~ __sap_ha_pacemaker_cluster_hana_instance_nr + "{{ ('mst' if ansible_os_family == 'Suse' else 'cln') ~ '_SAPHanaCon_' ~ __sap_ha_pacemaker_cluster_hana_sid ~ '_HDB' ~ __sap_ha_pacemaker_cluster_hana_instance_nr if sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name | string | length == 0 else sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name }}" diff --git a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_perf.yml b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_perf.yml index d43b3905c..1801b2fbe 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_perf.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_perf.yml @@ -20,7 +20,7 @@ __sap_ha_pacemaker_cluster_hana_hook_dictionary: # Recommended srhooks are set to true only if default dictionary is populated __sap_ha_pacemaker_cluster_hana_hook_tkover: - "{{ true if + "{{ true if (lookup('ansible.builtin.vars', __sap_ha_pacemaker_cluster_hana_hook_dictionary).tkover is defined and (sap_ha_pacemaker_cluster_hana_hook_tkover | bool)) else false }}"