From b9575789b89439b04be58ed2191212b88cd2a6aa Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 15 Sep 2023 11:24:51 +0200 Subject: [PATCH 1/3] sap_ha_pacemaker_cluster: enh: vip ip addresses can contain a /cidr suffix that will be stripped --- .../tasks/include_construct_vip_resources.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml index b269c4826..6480f1f9b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml @@ -6,17 +6,17 @@ ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_all_vip_fact: - key: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_ip_address }}" + value: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_ip_address | regex_replace('/*', '') }}" - key: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address }}" + value: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address | regex_replace('/*', '') }}" - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address | regex_replace('/*', '') }}" - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address | regex_replace('/*', '') }}" - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address | regex_replace('/*', '') }}" - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address | regex_replace('/*', '') }}" - name: "SAP HA Prepare Pacemaker - Combine VIP parameters" ansible.builtin.set_fact: From c6f640469d27eeb5f331adbfd648a64c79e5fa0e Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 15 Sep 2023 19:38:10 +0200 Subject: [PATCH 2/3] sap_ha_pacemaker_cluster: fix: VIP addresses applied corresponding to host type --- .../tasks/include_construct_vip_resources.yml | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml index 6480f1f9b..1007f703b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml @@ -5,33 +5,31 @@ - name: "SAP HA Prepare Pacemaker - Make a list of potential VIP definitions" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_all_vip_fact: - - key: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_ip_address | regex_replace('/*', '') }}" - - key: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address | regex_replace('/*', '') }}" - - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address | regex_replace('/*', '') }}" - - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address | regex_replace('/*', '') }}" - - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address | regex_replace('/*', '') }}" - - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address | regex_replace('/*', '') }}" + hana_scaleup_perf: "{{ + { + sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: sap_ha_pacemaker_cluster_vip_hana_primary_ip_address | regex_replace('/.*', ''), + sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name: sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address | regex_replace('/.*', '') + } }}" + nwas_abap_ascs_ers: "{{ + { + sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address | regex_replace('/.*', ''), + sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address | regex_replace('/.*', '') + } }}" + nwas_abap_pas_aas: "{{ + { + sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address | regex_replace('/.*', ''), + sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address | regex_replace('/.*', '') + } }}" - name: "SAP HA Prepare Pacemaker - Combine VIP parameters" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_vip_resource_definition: "{{ __sap_ha_pacemaker_cluster_vip_resource_definition | default({}) - | combine ({ vip_item.key : vip_item.value }) }}" - loop: "{{ __sap_ha_pacemaker_cluster_all_vip_fact }}" + | combine(__sap_ha_pacemaker_cluster_all_vip_fact[vip_item]) }}" + loop: "{{ sap_ha_pacemaker_cluster_host_type }}" loop_control: loop_var: vip_item - label: "{{ vip_item.key }}: {{ vip_item.value }}" - when: - - vip_item.key is defined - - vip_item.key != '' - - vip_item.value is defined - - vip_item.value != '' + # Repeat the VIP resource definition in a loop over the above combined possible parameters. - name: "SAP HA Prepare Pacemaker - Include variable construction for standard VIP resources" @@ -40,8 +38,11 @@ loop_control: index_var: loop_index loop_var: vip_list_item + label: "{{ vip_list_item.key }} - {{ vip_list_item.value }}" when: - __sap_ha_pacemaker_cluster_platform not in __sap_ha_pacemaker_cluster_supported_platforms + - vip_list_item.value != '' + - name: "SAP HA Prepare Pacemaker - Include variable construction for platform VIP resources" ansible.builtin.include_tasks: "platform/construct_vars_vip_resources_{{ __sap_ha_pacemaker_cluster_platform }}.yml" @@ -49,8 +50,11 @@ loop_control: index_var: loop_index loop_var: vip_list_item + label: "{{ vip_list_item.key }} - {{ vip_list_item.value }}" when: - __sap_ha_pacemaker_cluster_platform in __sap_ha_pacemaker_cluster_supported_platforms + - vip_list_item.value != '' + - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP Hana VIP constraints" ansible.builtin.include_tasks: @@ -59,7 +63,7 @@ loop_control: index_var: loop_index loop_var: vip_list_item + label: "{{ vip_list_item.key }} - {{ vip_list_item.value }}" when: - - sap_ha_pacemaker_cluster_vip_hana_primary_ip_address is defined - - sap_ha_pacemaker_cluster_vip_hana_primary_ip_address != '' - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 + - vip_list_item.value != '' From 667db5908f20a5d28a77a469ca963a17b09ff20b Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 19 Sep 2023 17:58:38 +0200 Subject: [PATCH 3/3] sap_ha_pacemaker_cluster: dev comment for host_type list conversion --- roles/sap_ha_pacemaker_cluster/defaults/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index c4bdd5f66..7726ec60c 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -79,6 +79,9 @@ sap_ha_pacemaker_cluster_resource_defaults: {} # nwas_abap_ascs_ers # nwas_abap_pas_aas # nwas_java_scs_ers (maybe) +# +# 'sap_ha_pacemaker_cluster_host_type' is converted from string to list type in +# 'tasks/ascertain_sap_landscape.yml'. sap_ha_pacemaker_cluster_host_type: "{{ sap_host_type | default(['hana_scaleup_perf']) }}" sap_ha_pacemaker_cluster_replication_type: none