Skip to content

Commit

Permalink
sap_vm_provision: amend var handling for storage and ha on ibmcloud
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-freeman committed May 29, 2024
1 parent db8fe35 commit e6af154
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
'value': entry.value,
}
]) %}
{%- elif not "disk_type" in entry.key %}
{%- elif (not "disk_type" in entry.key) and (not "disk_iops" in entry.key) %}
{%- set add_entry = new_element.extend([
{
'key': entry.key,
Expand Down
43 changes: 37 additions & 6 deletions roles/sap_vm_provision/tasks/common/set_etc_hosts_ha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@


# Ensure SAP AnyDB, SAP HANA or SAP NetWeaver hostname is not localhost in /etc/hosts. See SAP Note 1054467 - Local host name refers to loopback address.
# However, as IBM Cloud Load Balancer is a secure design using Back-end Pool servers with singular Port Number and Front-end Listener with single Port Number,
# and controls the Virtual IP from the Load Balancer. Therefore the Virtual IP is not added as a Secondary IP to the OS Network Interface,
# which causes connectivity issues due to SAP NetWeaver instance random dynamic port usage.
# As workaround, configure /etc/hosts to map Virtual Hostname to use the host IP Address instead of the Virtual IP Address
# However, as IBM Cloud Load Balancer is a secure design (using Back-end Pool servers with singular Port Number and Front-end Listener with single Port Number),
# which controls the Virtual IP from the Load Balancer - the Virtual IP is not added as a Secondary IP to the OS Network Interface.
# This causes connectivity issues due to SAP NetWeaver instance random dynamic port usage.
# As workaround, configure /etc/hosts to map Virtual Hostname to use the host IP Address instead of the Virtual IP Address,
# by appending an alias of the Virtual Hostname to the existing /etc/hosts entry for the host IP Address.
- name: Ansible Play for controlling execution to an Infrastructure Platform when High Availability is used - IBM Cloud
when:
- (groups["hana_secondary"] is defined and (groups["hana_secondary"] | length>0)) or (groups["nwas_ers"] is defined and (groups["nwas_ers"] | length>0)) or (groups["anydb_secondary"] is defined and (groups["anydb_secondary"] | length>0))
Expand All @@ -145,7 +146,8 @@
line: "{{ item }}"
state: present
loop:
- "{{ sap_vm_provision_dynamic_inventory_nw_ascs_ip }}\t{{ sap_swpm_ascs_instance_hostname }}.{{ ansible_domain }}\t{{ sap_swpm_ascs_instance_hostname }}"
- "{{ sap_vm_provision_dynamic_inventory_nw_ascs_ip }}\t{{ sap_vm_provision_dynamic_inventory_nw_ascs_hostname }}.{{ ansible_domain }}\t{{ sap_vm_provision_dynamic_inventory_nw_ascs_hostname }}\t{{ sap_swpm_ascs_instance_hostname }}.{{ ansible_domain }}\t{{ sap_swpm_ascs_instance_hostname }}"
- "{{ sap_vm_provision_dynamic_inventory_nw_ers_ip }}\t{{ sap_vm_provision_dynamic_inventory_nw_ers_hostname }}.{{ ansible_domain }}\t{{ sap_vm_provision_dynamic_inventory_nw_ers_hostname }}"
- "{{ (sap_ha_pacemaker_cluster_vip_nwas_abap_ers_ip_address | default('192.168.2.11/32')) | regex_replace('/.*', '') }}\t{{ sap_swpm_ers_instance_hostname }}.{{ ansible_domain }}\t{{ sap_swpm_ers_instance_hostname }}"
when:
- (groups["nwas_ers"] is defined and (groups["nwas_ers"] | length>0))
Expand All @@ -158,8 +160,37 @@
line: "{{ item }}"
state: present
loop:
- "{{ sap_vm_provision_dynamic_inventory_nw_ascs_ip }}\t{{ sap_vm_provision_dynamic_inventory_nw_ascs_hostname }}.{{ ansible_domain }}\t{{ sap_vm_provision_dynamic_inventory_nw_ascs_hostname }}"
- "{{ sap_vm_provision_dynamic_inventory_nw_ers_ip }}\t{{ sap_vm_provision_dynamic_inventory_nw_ers_hostname }}.{{ ansible_domain }}\t{{ sap_vm_provision_dynamic_inventory_nw_ers_hostname }}\t{{ sap_swpm_ers_instance_hostname }}.{{ ansible_domain }}\t{{ sap_swpm_ers_instance_hostname }}"
- "{{ (sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_ip_address | default('192.168.2.10/32')) | regex_replace('/.*', '') }}\t{{ sap_swpm_ascs_instance_hostname }}.{{ ansible_domain }}\t{{ sap_swpm_ascs_instance_hostname }}"
when:
- (groups["nwas_ers"] is defined and (groups["nwas_ers"] | length>0))
- ansible_chassis_asset_tag == 'ibmcloud'
- inventory_hostname_short in groups['nwas_ers']

# Remove /etc/hosts entries and then consolidate into one entry with aliases
- name: Remove /etc/hosts multiple entries for SAP NetWeaver ASCS and ASCS HA Virtual Hostname
ansible.builtin.lineinfile:
dest: /etc/hosts
line: "{{ item }}"
state: absent
loop:
- "{{ sap_vm_provision_dynamic_inventory_nw_ascs_ip }}\t{{ sap_vm_provision_dynamic_inventory_nw_ascs_hostname }}.{{ ansible_domain }}\t{{ sap_vm_provision_dynamic_inventory_nw_ascs_hostname }}"
- "{{ (sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_ip_address | default('192.168.2.10/32')) | regex_replace('/.*', '') }}\t{{ sap_swpm_ascs_instance_hostname }}.{{ ansible_domain }}\t{{ sap_swpm_ascs_instance_hostname }}"
- "{{ sap_vm_provision_dynamic_inventory_nw_ers_ip }}\t{{ sap_swpm_ers_instance_hostname }}.{{ ansible_domain }}\t{{ sap_swpm_ers_instance_hostname }}"
when:
- (groups["nwas_ers"] is defined and (groups["nwas_ers"] | length>0))
- ansible_chassis_asset_tag == 'ibmcloud'
- inventory_hostname_short in groups['nwas_ascs']

# Remove /etc/hosts entries and then consolidate into one entry with aliases
- name: Remove /etc/hosts multiple entries for SAP NetWeaver ERS and ERS HA Virtual Hostname
ansible.builtin.lineinfile:
dest: /etc/hosts
line: "{{ item }}"
state: absent
loop:
- "{{ sap_vm_provision_dynamic_inventory_nw_ers_ip }}\t{{ sap_vm_provision_dynamic_inventory_nw_ers_hostname }}.{{ ansible_domain }}\t{{ sap_vm_provision_dynamic_inventory_nw_ers_hostname }}"
- "{{ (sap_ha_pacemaker_cluster_vip_nwas_abap_ers_ip_address | default('192.168.2.11/32')) | regex_replace('/.*', '') }}\t{{ sap_swpm_ers_instance_hostname }}.{{ ansible_domain }}\t{{ sap_swpm_ers_instance_hostname }}"
when:
- (groups["nwas_ers"] is defined and (groups["nwas_ers"] | length>0))
- ansible_chassis_asset_tag == 'ibmcloud'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
'definition_key': storage_item.name,
'name': storage_item.name + idx|string,
'size': storage_item.disk_size | default(0),
'type': storage_item.disk_type | default('general-purpose')
'type': storage_item.disk_type | default('general-purpose'),
'iops': storage_item.disk_iops | default(omit)
}
]) %}
{%- endif %}
Expand All @@ -83,6 +84,7 @@
name: "{{ inventory_hostname + '-vol-' + vol_item.name | replace('_', '-')}}"
profile: "{{ vol_item.type }}"
capacity: "{{ vol_item.size }}"
iops: "{{ vol_item.iops | default(omit) }}"
ibmcloud_api_key: "{{ sap_vm_provision_ibmcloud_api_key }}"
loop: "{{ storage_disks_map }}"
loop_control:
Expand Down

0 comments on commit e6af154

Please sign in to comment.