From 78aacee8afcbde30a6134636e78da2103c31d085 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 14 Jan 2025 15:11:44 +0100 Subject: [PATCH 1/2] sap_ha_pacemaker_cluster: enable Simple Mount on RHEL --- .../tasks/RedHat/pre_steps_nwas_ascs_ers.yml | 23 +++++++++++++++++++ .../tasks/include_vars_nwas.yml | 6 +++++ .../sap_ha_pacemaker_cluster/vars/RedHat.yml | 3 ++- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_nwas_ascs_ers.yml diff --git a/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_nwas_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_nwas_ascs_ers.yml new file mode 100644 index 000000000..71ecb9227 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_nwas_ascs_ers.yml @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: Apache-2.0 +--- +# Identify the version of the resource agents and disable +# the use of "SimpleMount" if a minimum version is not satisfied. + +- name: "SAP HA Prepare Pacemaker - Block for detection of 'SAPStartSrv' availability" + block: + + - name: "SAP HA Prepare Pacemaker - Check the resource agents package" + ansible.builtin.shell: + set -o pipefail && \ + dnf info resource-agents-sap | awk '/^Version/ {print $3}' | sort | tail -n1 + register: __sap_ha_pacemaker_cluster_sapstartsrv_check + changed_when: false + failed_when: false + + - name: "SAP HA Prepare Pacemaker - Disable Simple Mount when min. package version is not available" + ansible.builtin.set_fact: + sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount: false + when: + - sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount | bool + - __sap_ha_pacemaker_cluster_sapstartsrv_check.stdout is defined + - "(__sap_ha_pacemaker_cluster_sapstartsrv_check.stdout) is version(__sap_ha_pacemaker_cluster_nwas_simple_mount_version, '<')" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_nwas.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_nwas.yml index ffbef8df0..0759f9e79 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_nwas.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_nwas.yml @@ -13,6 +13,12 @@ when: - "(role_path + '/vars/' + include_item + '.yml') is file" +- name: "SAP HA Prepare Pacemaker - Run NETWEAVER pre-steps" + ansible.builtin.include_tasks: + file: "{{ ansible_facts['os_family'] }}/pre_steps_nwas_ascs_ers.yml" + when: + - ansible_os_family == 'RedHat' + - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0 # Private variables are assigned following logic: # 1. Use backwards compatible var if new var is empty diff --git a/roles/sap_ha_pacemaker_cluster/vars/RedHat.yml b/roles/sap_ha_pacemaker_cluster/vars/RedHat.yml index e9dd9762d..967a2b993 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/RedHat.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/RedHat.yml @@ -158,4 +158,5 @@ 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 -sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount: false +sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount: true +__sap_ha_pacemaker_cluster_nwas_simple_mount_version: 4.15.1 From 57f3d04ca3aaa85fefd40f962a0b1bf349a0a8e5 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 15 Jan 2025 09:49:48 +0100 Subject: [PATCH 2/2] sap_ha_pacemaker_cluster: use internal var for RHEL Simple-Mount override - the internal var must be used for the decision after auto-discovery, because otherwise it can be overridden by the user (issue: command-line extra-vars take precedence over set_fact) - the pre-steps were moved to the end of the including file in order to override the internal var after its default was set --- .../tasks/RedHat/pre_steps_nwas_ascs_ers.yml | 2 +- .../tasks/include_vars_nwas.yml | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_nwas_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_nwas_ascs_ers.yml index 71ecb9227..cd8cab36d 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_nwas_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_nwas_ascs_ers.yml @@ -16,7 +16,7 @@ - name: "SAP HA Prepare Pacemaker - Disable Simple Mount when min. package version is not available" ansible.builtin.set_fact: - sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount: false + __sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount: false when: - sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount | bool - __sap_ha_pacemaker_cluster_sapstartsrv_check.stdout is defined diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_nwas.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_nwas.yml index 0759f9e79..0e43e5c5b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_nwas.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_nwas.yml @@ -13,13 +13,6 @@ when: - "(role_path + '/vars/' + include_item + '.yml') is file" -- name: "SAP HA Prepare Pacemaker - Run NETWEAVER pre-steps" - ansible.builtin.include_tasks: - file: "{{ ansible_facts['os_family'] }}/pre_steps_nwas_ascs_ers.yml" - when: - - ansible_os_family == 'RedHat' - - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0 - # Private variables are assigned following logic: # 1. Use backwards compatible var if new var is empty # 2. Use user input if new var is not empty @@ -397,3 +390,13 @@ # TODO: Remove backwards compatibility to typo __sap_ha_pacemaker_cluster_storage_nfs_filesystem_type: "{{ sap_ha_pacemaker_cluster_storage_nfs_filesytem_type | d(sap_ha_pacemaker_cluster_storage_nfs_filesystem_type) }}" + +# This must be run after the assignment of +# __sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount +# TODO: separate pre-steps from variable includes for NW and HANA +- name: "SAP HA Prepare Pacemaker - Run NETWEAVER pre-steps" + ansible.builtin.include_tasks: + file: "{{ ansible_facts['os_family'] }}/pre_steps_nwas_ascs_ers.yml" + when: + - ansible_os_family == 'RedHat' + - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0