Skip to content

Commit

Permalink
Merge pull request #458 from ja9fuchs/ha-vip-fix
Browse files Browse the repository at this point in the history
sap_ha_pacemaker_cluster: fixes to the VIP address parameters
  • Loading branch information
ja9fuchs authored Sep 19, 2023
2 parents 1e177de + 667db59 commit 88d3868
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 22 deletions.
3 changes: 3 additions & 0 deletions roles/sap_ha_pacemaker_cluster/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
- key: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name }}"
value: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address }}"
- key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name }}"
value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address }}"
- key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name }}"
value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address }}"
- key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name }}"
value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address }}"
- key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name }}"
value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address }}"
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"
Expand All @@ -40,17 +38,23 @@
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"
loop: "{{ query('dict', __sap_ha_pacemaker_cluster_vip_resource_definition) }}"
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:
Expand All @@ -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 != ''

0 comments on commit 88d3868

Please sign in to comment.