Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion roles/sap_vm_provision/tasks/common/set_etc_hosts_ha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
# - "{{ sap_vm_provision_dynamic_inventory_nw_pas_ip }}\t{{ sap_vm_provision_dynamic_inventory_nw_pas_hostname }}.{{ ansible_domain }}\t{{ sap_vm_provision_dynamic_inventory_nw_pas_hostname }}"
# Allows to build ASCS ERS cluster without PAS if PAS details are not provided
- "{{ sap_vm_provision_dynamic_inventory_nw_pas_ip | string + '\t' + sap_vm_provision_dynamic_inventory_nw_pas_hostname + '.' + ansible_domain + '\t' + sap_vm_provision_dynamic_inventory_nw_pas_hostname
if (sap_vm_provision_dynamic_inventory_nw_pas_hostname is defined and sap_vm_provision_dynamic_inventory_nw_pas_hostname | length > 0 )
if (sap_vm_provision_dynamic_inventory_nw_pas_hostname is defined and sap_vm_provision_dynamic_inventory_nw_pas_hostname is not none and sap_vm_provision_dynamic_inventory_nw_pas_hostname | length > 0 )
and (sap_vm_provision_dynamic_inventory_nw_pas_ip is defined and sap_vm_provision_dynamic_inventory_nw_pas_ip | length > 0) else ''}}"
when:
- (groups[sap_vm_provision_group_nwas_ers] is defined and (groups[sap_vm_provision_group_nwas_ers] | length>0))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
loop:
"{{
(groups[sap_vm_provision_group_hana_primary] + groups[sap_vm_provision_group_hana_secondary]
if groups[sap_vm_provision_group_hana_secondary] is defined and groups[sap_vm_provision_group_hana_secondary] else [])
if groups[sap_vm_provision_group_hana_secondary] is defined and groups[sap_vm_provision_group_hana_secondary] | length > 0 else [])
+ (groups[sap_vm_provision_group_anydb_primary] + groups[sap_vm_provision_group_anydb_secondary]
if groups[sap_vm_provision_group_anydb_secondary] is defined and groups[sap_vm_provision_group_anydb_secondary] else [])
if groups[sap_vm_provision_group_anydb_secondary] is defined and groups[sap_vm_provision_group_anydb_secondary] | length > 0 else [])
+ (groups[sap_vm_provision_group_nwas_ascs] + groups[sap_vm_provision_group_nwas_ers]
if groups[sap_vm_provision_group_nwas_ers] is defined and groups[sap_vm_provision_group_nwas_ers] else [])
if groups[sap_vm_provision_group_nwas_ers] is defined and groups[sap_vm_provision_group_nwas_ers] | length > 0 else [])
}}"
loop_control:
loop_var: host_node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,13 @@

- name: MS Azure Load Balancer (network L4) - Define Ansible Variable of Load Balancer for Database Server
ansible.builtin.set_fact:
__sap_vm_provision_task_msazure_lb1_info: "{{ __sap_vm_provision_task_msazure_lb1a_info if (groups[sap_vm_provision_group_hana_secondary] is defined and (groups[sap_vm_provision_group_hana_secondary]|length>0)) else __sap_vm_provision_task_msazure_lb1b_info if (groups[sap_vm_provision_group_anydb_secondary] is defined and (groups[sap_vm_provision_group_anydb_secondary]|length>0)) }}"
__sap_vm_provision_task_msazure_lb1_info:
"{{ __sap_vm_provision_task_msazure_lb1a_info
if (groups[sap_vm_provision_group_hana_secondary] is defined and (groups[sap_vm_provision_group_hana_secondary]|length>0))
else __sap_vm_provision_task_msazure_lb1b_info
if (groups[sap_vm_provision_group_anydb_secondary] is defined and (groups[sap_vm_provision_group_anydb_secondary]|length>0))
else none }}"

when: (groups[sap_vm_provision_group_hana_secondary] is defined and (groups[sap_vm_provision_group_hana_secondary]|length>0)) or (groups[sap_vm_provision_group_anydb_secondary] is defined and (groups[sap_vm_provision_group_anydb_secondary]|length>0))

- name: Set fact to hold loop variables from include_tasks when SAP HANA HA
Expand Down
8 changes: 4 additions & 4 deletions roles/sap_vm_temp_vip/tasks/get_temp_vip_details.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
- name: Calculate prefix from IP {{ sap_vm_temp_vip_default_ip }} if sap_vm_temp_vip_default_netmask is empty
ansible.builtin.set_fact:
__sap_vm_temp_vip_get_prefix_ip:
"{{ (__sap_vm_temp_vip_inet[0] | basename) if __sap_vm_temp_vip_inet | length > 0 else __sap_vm_temp_vip_inet }}"
"{{ __sap_vm_temp_vip_inet[0] if __sap_vm_temp_vip_inet | length > 0 else '' }}"
vars:
__sap_vm_temp_vip_inet: "{{ __sap_vm_temp_vip_get_ips.stdout | regex_search('inet ([0-9.]+/[0-9]+)', '\\1') }}"
__sap_vm_temp_vip_inet: "{{ __sap_vm_temp_vip_get_ips.stdout | regex_search('inet [0-9.]+/([0-9]+)', '\\1') }}"
when:
- sap_vm_temp_vip_default_prefix == ''
- sap_vm_temp_vip_default_netmask == ''
- __sap_vm_temp_vip_get_ips is defined and __sap_vm_temp_vip_get_ips.stdout is defined and __sap_vm_temp_vip_get_ips.stdout | length > 0
- __sap_vm_temp_vip_get_ips.stdout is defined and __sap_vm_temp_vip_get_ips.stdout | length > 0
changed_when: false


Expand Down Expand Up @@ -83,7 +83,7 @@
__sap_vm_temp_vip_brd: "{{ __sap_vm_temp_vip_get_ips.stdout | regex_search('brd ([0-9.]+)', '\\1') }}"
when:
- sap_vm_temp_vip_default_broadcast == ''
- __sap_vm_temp_vip_get_ips is defined and __sap_vm_temp_vip_get_ips.stdout is defined and __sap_vm_temp_vip_get_ips.stdout | length > 0
- __sap_vm_temp_vip_get_ips.stdout is defined and __sap_vm_temp_vip_get_ips.stdout | length > 0
changed_when: false

# Combine final broadcast IP based on decision below:
Expand Down
4 changes: 2 additions & 2 deletions roles/sap_vm_temp_vip/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

- name: Block to ensure that only supported groups are allowed
when:
- group_names | intersect([sap_vm_temp_vip_group_hana_primary, sap_vm_temp_vip_group_hana_secondary, sap_vm_temp_vip_group_anydb_primary,
sap_vm_temp_vip_group_anydb_secondary, sap_vm_temp_vip_group_nwas_ascs, sap_vm_temp_vip_group_nwas_ers])
- (group_names | intersect([sap_vm_temp_vip_group_hana_primary, sap_vm_temp_vip_group_hana_secondary, sap_vm_temp_vip_group_anydb_primary,
sap_vm_temp_vip_group_anydb_secondary, sap_vm_temp_vip_group_nwas_ascs, sap_vm_temp_vip_group_nwas_ers])) | length > 0
block:

# - name: Identify OS Primary Network Interface
Expand Down
9 changes: 6 additions & 3 deletions roles/sap_vm_temp_vip/tasks/set_temp_vip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@


# Define VIP address based on target host group which is filtered in main.yml
# Else ensures that we always return String, not NoneType.
- name: Set fact for VIP address depending on target host group
ansible.builtin.set_fact:
__sap_vm_temp_vip_address: >-
Expand All @@ -34,14 +35,16 @@
{{ sap_vm_temp_vip_nwas_abap_ascs | regex_replace('/.*', '') }}
{%- elif groups[sap_vm_temp_vip_group_nwas_ers] | d([]) | length > 0 and inventory_hostname in groups[sap_vm_temp_vip_group_nwas_ers] -%}
{{ sap_vm_temp_vip_nwas_abap_ers | regex_replace('/.*', '') }}
{%- else -%}
{{ '' }}
{%- endif %}

# Get content of ip address show filtered by VIP
- name: Get contents of ip address show for {{ __sap_vm_temp_vip_address }}
ansible.builtin.shell:
cmd: set -o pipefail && ip -oneline address show | grep {{ __sap_vm_temp_vip_address }}
when:
- __sap_vm_temp_vip_address is defined and __sap_vm_temp_vip_address | length > 0
- __sap_vm_temp_vip_address | length > 0
register: __sap_vm_temp_vip_get_vip
changed_when: false
ignore_errors: true
Expand Down Expand Up @@ -72,7 +75,7 @@
__vip_multiple: "{{ true if __sap_vm_temp_vip_get_vip.stdout_lines | length > 1 else false }}"
when:
- __sap_vm_temp_vip_get_vip.stdout is defined and __sap_vm_temp_vip_get_vip.stdout | length > 0
- __sap_vm_temp_vip_address is defined and __sap_vm_temp_vip_address | length > 0
- __sap_vm_temp_vip_address | length > 0


# Dynamically generate IP creation command depending on values gathered before:
Expand All @@ -88,7 +91,7 @@
ip address add {{ __sap_vm_temp_vip_address }}/{{ __sap_vm_temp_vip_prefix }} brd + dev {{ sap_vm_temp_vip_default_interface }} noprefixroute
{%- endif -%}
when:
- __sap_vm_temp_vip_address is defined and __sap_vm_temp_vip_address | length > 0
- __sap_vm_temp_vip_address | length > 0
- __sap_vm_temp_vip_prefix | length > 0
- __sap_vm_temp_vip_get_vip.stdout is defined and __sap_vm_temp_vip_get_vip.stdout | length == 0

Expand Down
9 changes: 6 additions & 3 deletions roles/sap_vm_temp_vip/tasks/set_temp_vip_lb_listener.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# 55550 - SAP HANA and SAP AnyDB
# 55551 - SAP SAP NetWeaver ASCS
# 55552 - SAP NetWeaver ERS
# Else ensures that we always return String, not NoneType.
- name: Set fact for temporary listening port
ansible.builtin.set_fact:
__sap_vm_temp_vip_port: >-
Expand All @@ -14,6 +15,8 @@
55551
{%- elif groups[sap_vm_temp_vip_group_nwas_ers] | d([]) | length > 0 and inventory_hostname in groups[sap_vm_temp_vip_group_nwas_ers] -%}
55552
{%- else -%}
{{ '' }}
{%- endif %}


Expand All @@ -24,14 +27,14 @@
cmd: ss -tulnH "sport = :{{ __sap_vm_temp_vip_port }}"
register: __sap_vm_temp_vip_port_check
when:
- __sap_vm_temp_vip_port is defined and __sap_vm_temp_vip_port | length > 0
- __sap_vm_temp_vip_port | length > 0
changed_when: false


- name: Block to start temporary netcat processes for Load Balancer Health Checks
when:
- __sap_vm_temp_vip_address is defined and __sap_vm_temp_vip_address | length > 0
- __sap_vm_temp_vip_port is defined and __sap_vm_temp_vip_port | length > 0
- __sap_vm_temp_vip_address | length > 0
- __sap_vm_temp_vip_port | length > 0
- __sap_vm_temp_vip_port_check.stdout is defined and __sap_vm_temp_vip_port_check.stdout | length == 0
- __sap_vm_temp_vip_prefix | length > 0 # Dont execute if prefix was empty during VIP creation
block:
Expand Down