Skip to content

Commit 371bc9f

Browse files
committed
update injected vars for sap_ha role
1 parent 6d71b8f commit 371bc9f

16 files changed

Lines changed: 97 additions & 97 deletions

roles/sap_ha_pacemaker_cluster/tasks/include_vars/detect_platform_type.yml

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,37 @@
55
### Facts already available to Ansible
66
#
77
### Amazon Web Services EC2 Virtual Server. Not applicable for AWS Classic.
8-
# ansible_chassis_asset_tag: "Amazon EC2" # SMBIOS Chassis Asset Tag
9-
# ansible_board_asset_tag: "i-043d3c1a889ed9016" # SMBIOS Baseboard Asset Tag, ID of virtual machine on platform
10-
# ansible_chassis_vendor: "Amazon EC2"
11-
# ansible_product_name: "r5.8xlarge" # IaaS profile name
12-
# ansible_system_vendor: "Amazon EC2"
8+
# ansible_facts['chassis_asset_tag']: "Amazon EC2" # SMBIOS Chassis Asset Tag
9+
# ansible_facts['board_asset_tag']: "i-043d3c1a889ed9016" # SMBIOS Baseboard Asset Tag, ID of virtual machine on platform
10+
# ansible_facts['chassis_vendor']: "Amazon EC2"
11+
# ansible_facts['product_name']: "r5.8xlarge" # IaaS profile name
12+
# ansible_facts['system_vendor']: "Amazon EC2"
1313
#
1414
### Google Cloud Compute Engine Virtual Machine.
15-
# ansible_chassis_asset_tag: "NA" # SMBIOS Chassis Asset Tag
16-
# ansible_board_asset_tag: "9EAF3038-7EF5-3F1E-6620-FB3BDA7A3709" # SMBIOS Baseboard Asset Tag, ID of virtual machine on platform
17-
# ansible_chassis_vendor: "Google"
18-
# ansible_product_name: "Google Compute Engine"
19-
# ansible_system_vendor: "Google"
15+
# ansible_facts['chassis_asset_tag']: "NA" # SMBIOS Chassis Asset Tag
16+
# ansible_facts['board_asset_tag']: "9EAF3038-7EF5-3F1E-6620-FB3BDA7A3709" # SMBIOS Baseboard Asset Tag, ID of virtual machine on platform
17+
# ansible_facts['chassis_vendor']: "Google"
18+
# ansible_facts['product_name']: "Google Compute Engine"
19+
# ansible_facts['system_vendor']: "Google"
2020
#
2121
### IBM Cloud Virtual Server. Not applicable for IBM Cloud Classic Infrastructure.
22-
# ansible_chassis_asset_tag: "ibmcloud" # SMBIOS Chassis Asset Tag
23-
# ansible_board_asset_tag: "0c7d4459-xxxx-yyyy-zzzz-abcdefghijkl" # SMBIOS Baseboard Asset Tag, ID of virtual machine on platform
24-
# ansible_chassis_vendor: "IBM:Cloud Compute Server 1.0:mx2-16x128" # IaaS profile name as suffix (after colon)
25-
# ansible_product_name: "Standard PC (i440FX + PIIX, 1996)"
26-
# ansible_system_vendor: "QEMU"
22+
# ansible_facts['chassis_asset_tag']: "ibmcloud" # SMBIOS Chassis Asset Tag
23+
# ansible_facts['board_asset_tag']: "0c7d4459-xxxx-yyyy-zzzz-abcdefghijkl" # SMBIOS Baseboard Asset Tag, ID of virtual machine on platform
24+
# ansible_facts['chassis_vendor']: "IBM:Cloud Compute Server 1.0:mx2-16x128" # IaaS profile name as suffix (after colon)
25+
# ansible_facts['product_name']: "Standard PC (i440FX + PIIX, 1996)"
26+
# ansible_facts['system_vendor']: "QEMU"
2727
#
2828
### Microsoft Azure Virtual Machine. Not applicable for MS Azure Classic/ASM.
29-
# ansible_chassis_asset_tag: "7783-xxxx-yyyy-zzzz-aaaa-bbbb-cc" # SMBIOS Chassis Asset Tag
30-
# ansible_board_asset_tag: "None" # SMBIOS Baseboard Asset Tag
31-
# ansible_chassis_vendor: "Microsoft Corporation"
32-
# ansible_product_name: "Virtual Machine"
33-
# ansible_system_vendor: "70f4a858-1eea-4c35-b9e1-e179c32fc6b5" # ID of virtual machine on platform
29+
# ansible_facts['chassis_asset_tag']: "7783-xxxx-yyyy-zzzz-aaaa-bbbb-cc" # SMBIOS Chassis Asset Tag
30+
# ansible_facts['board_asset_tag']: "None" # SMBIOS Baseboard Asset Tag
31+
# ansible_facts['chassis_vendor']: "Microsoft Corporation"
32+
# ansible_facts['product_name']: "Virtual Machine"
33+
# ansible_facts['system_vendor']: "70f4a858-1eea-4c35-b9e1-e179c32fc6b5" # ID of virtual machine on platform
3434
#
3535
### VMware vSphere
36-
# ansible_product_name: "VMware7,1",
37-
# ansible_system_vendor: "VMware, Inc.",
38-
# ansible_virtualization_type: "VMware"
36+
# ansible_facts['product_name']: "VMware7,1",
37+
# ansible_facts['system_vendor']: "VMware, Inc.",
38+
# ansible_facts['virtualization_type']: "VMware"
3939
#
4040
### End of comment
4141

@@ -49,28 +49,28 @@
4949

5050
- name: "SAP HA Prepare Pacemaker - Check if platform is Amazon Web Services EC2 Virtual Server"
5151
when:
52-
- '"amazon" in ansible_system_vendor | lower
53-
or "amazon" in ansible_product_name | lower
54-
or "amazon" in ansible_product_version | lower'
52+
- '"amazon" in ansible_facts["system_vendor"] | lower
53+
or "amazon" in ansible_facts["product_name"] | lower
54+
or "amazon" in ansible_facts["product_version"] | lower'
5555
ansible.builtin.set_fact:
5656
__sap_ha_pacemaker_cluster_platform: cloud_aws_ec2_vs
5757

5858
- name: "SAP HA Prepare Pacemaker - Check if platform is Google Cloud Compute Engine Virtual Machine"
5959
when:
60-
- ansible_product_name == 'Google Compute Engine'
60+
- ansible_facts['product_name'] == 'Google Compute Engine'
6161
ansible.builtin.set_fact:
6262
__sap_ha_pacemaker_cluster_platform: cloud_gcp_ce_vm
6363

6464
- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Cloud Virtual Server"
6565
when:
66-
- ansible_chassis_asset_tag == 'ibmcloud'
66+
- ansible_facts['chassis_asset_tag'] == 'ibmcloud'
6767
ansible.builtin.set_fact:
6868
__sap_ha_pacemaker_cluster_platform: cloud_ibmcloud_vs
6969

7070
- name: "SAP HA Prepare Pacemaker - Check if platform is Microsoft Azure Virtual Machine"
7171
when:
72-
- ansible_product_name == 'Virtual Machine'
73-
- ansible_chassis_vendor == 'Microsoft Corporation'
72+
- ansible_facts['product_name'] == 'Virtual Machine'
73+
- ansible_facts['chassis_vendor'] == 'Microsoft Corporation'
7474
ansible.builtin.set_fact:
7575
__sap_ha_pacemaker_cluster_platform: cloud_msazure_vm
7676

@@ -80,13 +80,13 @@
8080
register: __sap_ha_pacemaker_cluster_power_rsct_check
8181
changed_when: false
8282
check_mode: false
83-
when: ansible_architecture == "ppc64le"
83+
when: ansible_facts['architecture'] == "ppc64le"
8484

8585
- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power - Fail if RSCT binary is missing"
8686
ansible.builtin.fail:
8787
msg: Please install RSCT from IBM Power Systems service and productivity tools repository
8888
when:
89-
- ansible_architecture == "ppc64le"
89+
- ansible_facts['architecture'] == "ppc64le"
9090
- __sap_ha_pacemaker_cluster_power_rsct_check.stdout == ""
9191

9292
- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power - Run 'ctgethscid'"
@@ -96,26 +96,26 @@
9696
changed_when: false
9797
check_mode: false
9898
when:
99-
- ansible_architecture == "ppc64le"
99+
- ansible_facts['architecture'] == "ppc64le"
100100
- __sap_ha_pacemaker_cluster_power_rsct_check.stdout != ""
101101

102102
- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power Virtual Server from IBM Cloud"
103103
when:
104-
- ansible_architecture == "ppc64le"
104+
- ansible_facts['architecture'] == "ppc64le"
105105
- '"ibmcloud" in __sap_ha_pacemaker_cluster_power_rsct_hscid.stdout'
106106
ansible.builtin.set_fact:
107107
__sap_ha_pacemaker_cluster_platform: cloud_ibmcloud_powervs
108108

109109
- name: "SAP HA Prepare Pacemaker - Check if platform is IBM PowerVM"
110110
when:
111-
- ansible_architecture == "ppc64le"
111+
- ansible_facts['architecture'] == "ppc64le"
112112
- '"ibmcloud" not in __sap_ha_pacemaker_cluster_power_rsct_hscid.stdout'
113113
ansible.builtin.set_fact:
114114
__sap_ha_pacemaker_cluster_platform: hyp_ibmpower_vm
115115

116116
# - name: "SAP HA Prepare Pacemaker - Check if platform is VMware vSphere"
117117
# when:
118-
# - ansible_virtualization_type == 'VMware'
118+
# - ansible_facts['virtualization_type'] == 'VMware'
119119
# ansible.builtin.set_fact:
120120
# __sap_ha_pacemaker_cluster_platform: hyp_vmware_vsphere_vm
121121

roles/sap_ha_pacemaker_cluster/tasks/include_vars/include_common.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
# Assumption: The local loopback "lo" is always in the list.
1414
- name: "SAP HA Prepare Pacemaker - Set network interface name when only one interface is present"
1515
ansible.builtin.set_fact:
16-
__sap_ha_pacemaker_cluster_vip_client_interface: "{{ ansible_default_ipv4.interface }}"
16+
__sap_ha_pacemaker_cluster_vip_client_interface: "{{ ansible_facts['default_ipv4'].interface }}"
1717
when:
18-
- ansible_interfaces | length <= 2
18+
- ansible_facts['interfaces'] | length <= 2
1919
- sap_ha_pacemaker_cluster_vip_client_interface == ''
2020

2121

@@ -30,16 +30,16 @@
3030
loop: "{{ __var_files }}"
3131
vars:
3232
__vars_file: "{{ role_path }}/vars/{{ item }}"
33-
__distribution_major: "{{ ansible_distribution ~ '_' ~ ansible_distribution_major_version }}"
34-
__distribution_minor: "{{ ansible_distribution ~ '_' ~ ansible_distribution_version }}"
33+
__distribution_major: "{{ ansible_facts['distribution'] ~ '_' ~ ansible_facts['distribution_major_version'] }}"
34+
__distribution_minor: "{{ ansible_facts['distribution'] ~ '_' ~ ansible_facts['distribution_version'] }}"
3535
# Enables loading of shared vars between SLES and SLES_SAP
36-
__distribution_major_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_major_version }}"
37-
__distribution_minor_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_version }}"
36+
__distribution_major_split: "{{ ansible_facts['distribution'].split('_')[0] ~ '_' ~ ansible_facts['distribution_major_version'] }}"
37+
__distribution_minor_split: "{{ ansible_facts['distribution'].split('_')[0] ~ '_' ~ ansible_facts['distribution_version'] }}"
3838
__var_files: >-
3939
{{
4040
[
41-
ansible_os_family ~ '.yml',
42-
(ansible_distribution ~ '.yml') if ansible_distribution != ansible_os_family else None,
41+
ansible_facts['os_family'] ~ '.yml',
42+
(ansible_facts['distribution'] ~ '.yml') if ansible_facts['distribution'] != ansible_facts['os_family'] else None,
4343
(__distribution_major_split ~ '.yml') if __distribution_major_split != __distribution_major else None,
4444
(__distribution_minor_split ~ '.yml') if __distribution_minor_split != __distribution_minor else None,
4545
__distribution_major ~ '.yml',

roles/sap_ha_pacemaker_cluster/tasks/include_vars/include_hana.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
else sap_ha_pacemaker_cluster_hanacontroller_resource_name }}"
7575

7676
__sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name:
77-
"{{ ('mst' if ansible_os_family == 'Suse' else 'cln') ~ '_SAPHanaCon_' ~ __sap_ha_pacemaker_cluster_hana_sid ~ '_HDB' ~ __sap_ha_pacemaker_cluster_hana_instance_nr
77+
"{{ ('mst' if ansible_facts['os_family'] == 'Suse' else 'cln') ~ '_SAPHanaCon_' ~ __sap_ha_pacemaker_cluster_hana_sid ~ '_HDB' ~ __sap_ha_pacemaker_cluster_hana_instance_nr
7878
if sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name | string | length == 0
7979
else sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name }}"
8080

roles/sap_ha_pacemaker_cluster/tasks/include_vars/include_platform.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
ansible.builtin.set_fact:
1717
__sap_ha_pacemaker_cluster_pcmk_host_map: |-
1818
{% for node in ansible_play_hosts_all -%}
19-
{{ hostvars[node].ansible_hostname }}:{{ hostvars[node].ansible_board_asset_tag }}
19+
{{ hostvars[node].ansible_facts['hostname'] }}:{{ hostvars[node].ansible_facts['board_asset_tag'] }}
2020
{%- if not loop.last %};{% endif %}
2121
{% endfor %}
2222
when: __sap_ha_pacemaker_cluster_platform == "cloud_aws_ec2_vs"
@@ -35,7 +35,7 @@
3535
ansible.builtin.set_fact:
3636
__sap_ha_pacemaker_cluster_pcmk_host_map: |-
3737
{% for node in ansible_play_hosts_all -%}
38-
{{ hostvars[node].ansible_hostname }}:{{ hostvars[node].__sap_ha_pacemaker_cluster_register_ibmcloud_powervs_host.stdout }}
38+
{{ hostvars[node].ansible_facts['hostname'] }}:{{ hostvars[node].__sap_ha_pacemaker_cluster_register_ibmcloud_powervs_host.stdout }}
3939
{%- if not loop.last %};{% endif %}
4040
{% endfor %}
4141
when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_powervs"
@@ -55,7 +55,7 @@
5555
ansible.builtin.set_fact:
5656
__sap_ha_pacemaker_cluster_pcmk_host_map: |-
5757
{% for node in ansible_play_hosts_all -%}
58-
{{ hostvars[node].ansible_hostname }}:{{ hostvars[node].sap_ha_pacemaker_cluster_ibmpower_vm_hmc_system_partition_name }}
58+
{{ hostvars[node].ansible_facts['hostname'] }}:{{ hostvars[node].sap_ha_pacemaker_cluster_ibmpower_vm_hmc_system_partition_name }}
5959
{%- if not loop.last %};{% endif %}
6060
{% endfor %}
6161
when: __sap_ha_pacemaker_cluster_platform == "hyp_ibmpower_vm"
@@ -66,7 +66,7 @@
6666
ansible.builtin.set_fact:
6767
__sap_ha_pacemaker_cluster_pcmk_host_map: |-
6868
{% for node in ansible_play_hosts_all -%}
69-
{{ hostvars[node].ansible_hostname }}:{{ hostvars[node].__sap_ha_pacemaker_cluster_register_ibmcloud_vs_host.stdout }}
69+
{{ hostvars[node].ansible_facts['hostname'] }}:{{ hostvars[node].__sap_ha_pacemaker_cluster_register_ibmcloud_vs_host.stdout }}
7070
{%- if not loop.last %};{% endif %}
7171
{% endfor %}
7272
when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_vs"
@@ -77,7 +77,7 @@
7777
ansible.builtin.set_fact:
7878
__sap_ha_pacemaker_cluster_pcmk_host_map: |-
7979
{% for node in ansible_play_hosts_all -%}
80-
{{ hostvars[node].ansible_hostname }}:{{ hostvars[node].ansible_hostname }}
80+
{{ hostvars[node].ansible_facts['hostname'] }}:{{ hostvars[node].ansible_facts['hostname'] }}
8181
{%- if not loop.last %};{% endif %}
8282
{% endfor %}
8383
when: __sap_ha_pacemaker_cluster_platform == "cloud_msazure_vm"

roles/sap_ha_pacemaker_cluster/tasks/include_vars/validate_input_parameters.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,16 @@
143143
fail_msg: |
144144
Multiple interfaces are found on the system.
145145
146-
{{ ansible_interfaces | to_nice_yaml }}
146+
{{ ansible_facts['interfaces'] | to_nice_yaml }}
147147
148148
In this case 'sap_ha_pacemaker_cluster_vip_client_interface' must be defined.
149149
when:
150-
- ansible_interfaces | length > 2
150+
- ansible_facts['interfaces'] | length > 2
151151

152152
- name: "SAP HA Prepare Pacemaker - Verify that the custom NIC name exists"
153153
ansible.builtin.assert:
154154
that:
155-
- sap_ha_pacemaker_cluster_vip_client_interface in ansible_interfaces
155+
- sap_ha_pacemaker_cluster_vip_client_interface in ansible_facts['interfaces']
156156
fail_msg: "The interface '{{ sap_ha_pacemaker_cluster_vip_client_interface }}' does not exist on this system!"
157157
when:
158158
- sap_ha_pacemaker_cluster_vip_client_interface | length > 0

roles/sap_ha_pacemaker_cluster/tasks/pre_tasks/pre_nwas_cs_ers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,5 +195,5 @@
195195
else __sap_ha_pacemaker_cluster_nwas_ascs_sapinstance_instance_name
196196
}}"
197197
when:
198-
- ansible_os_family == 'RedHat'
198+
- ansible_facts['os_family'] == 'RedHat'
199199
ignore_errors: "{{ ansible_check_mode }}"

roles/sap_ha_pacemaker_cluster/tasks/prepare_vars/prepare_common.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
- not sap_ha_pacemaker_cluster_ha_cluster is defined
3838
ansible.builtin.set_fact:
3939
__sap_ha_pacemaker_cluster_ha_cluster:
40-
node_name: "{{ ansible_hostname }}"
41-
pcs_address: "{{ ansible_default_ipv4.address }}"
40+
node_name: "{{ ansible_facts['hostname'] }}"
41+
pcs_address: "{{ ansible_facts['default_ipv4'].address }}"
4242

4343

4444
# Combine following extra packages together:
@@ -61,7 +61,7 @@
6161
(sap_ha_pacemaker_cluster_zypper_patterns
6262
+ __sap_ha_pacemaker_cluster_sap_zypper_patterns)
6363
| unique | select() }}"
64-
when: ansible_os_family == 'Suse'
64+
when: ansible_facts['os_family'] == 'Suse'
6565

6666
# Combine following fence packages together:
6767
# __sap_ha_pacemaker_cluster_fence_agent_packages_minimal -> os default

roles/sap_ha_pacemaker_cluster/tasks/prepare_vars/prepare_final_hacluster_vars.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
ha_cluster_extra_packages: "{{ __sap_ha_pacemaker_cluster_extra_packages }}"
9090

9191
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_zypper_patterns'"
92-
when: __sap_ha_pacemaker_cluster_zypper_patterns is defined and ansible_os_family == 'Suse'
92+
when: __sap_ha_pacemaker_cluster_zypper_patterns is defined and ansible_facts['os_family'] == 'Suse'
9393
ansible.builtin.set_fact: # noqa var-naming[no-role-prefix]
9494
ha_cluster_zypper_patterns: "{{ __sap_ha_pacemaker_cluster_zypper_patterns }}"
9595

roles/sap_ha_pacemaker_cluster/tasks/prepare_vars/prepare_hana_scaleup.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
attrs:
7373
# SUSE recommended monitor interval is 60
7474
- name: interval
75-
value: "{{ 60 if ansible_os_family == 'Suse' else 59 }}"
75+
value: "{{ 60 if ansible_facts['os_family'] == 'Suse' else 59 }}"
7676
- name: role
7777
value: Master
7878
- name: timeout
@@ -116,7 +116,7 @@
116116
ansible.builtin.set_fact:
117117
__sap_ha_pacemaker_cluster_hana_resource_clone_name: "{{ __sap_ha_pacemaker_cluster_hana_resource_clone_msl_name }}"
118118
when:
119-
- ansible_os_family == 'Suse'
119+
- ansible_facts['os_family'] == 'Suse'
120120

121121

122122
- name: "SAP HA Prepare Pacemaker - Add resource clone: SAP HANA DB"
@@ -142,7 +142,7 @@
142142
value: "true"
143143
when:
144144
- __clone_hana.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id'))
145-
- ansible_os_family != 'Suse'
145+
- ansible_facts['os_family'] != 'Suse'
146146

147147
- name: "SAP HA Prepare Pacemaker - Add master slave resource clone: SAP HANA DB"
148148
ansible.builtin.set_fact:
@@ -167,7 +167,7 @@
167167
ms: true
168168
when:
169169
- __clone_hana.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id'))
170-
- ansible_os_family == 'Suse'
170+
- ansible_facts['os_family'] == 'Suse'
171171

172172
# First start Topology, then HANA (automatically stops in reverse order)
173173
- name: "SAP HA Prepare Pacemaker - Add order constraint: Topology starts before DB"

roles/sap_ha_pacemaker_cluster/tasks/prepare_vars/prepare_nwas_abap_ascs_ers_simple_mount.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
- name: timeout
2222
value: 20s
2323
- name: interval
24-
value: "{{ '120s' if ansible_os_family == 'Suse' else '0s' }}"
24+
value: "{{ '120s' if ansible_facts['os_family'] == 'Suse' else '0s' }}"
2525
- name: enabled
2626
value: 'false'
2727
when:
@@ -45,7 +45,7 @@
4545
- name: timeout
4646
value: 20s
4747
- name: interval
48-
value: "{{ '120s' if ansible_os_family == 'Suse' else '0s' }}"
48+
value: "{{ '120s' if ansible_facts['os_family'] == 'Suse' else '0s' }}"
4949
- name: enabled
5050
value: 'false'
5151
when:

0 commit comments

Comments
 (0)