forked from SUSE/ha-sap-terraform-deployments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netweaver.sls
184 lines (170 loc) · 7.66 KB
/
netweaver.sls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
{%- if grains['provider'] == 'libvirt' %}
{%- set virtual_host_interface = 'eth1' %}
{%- else %}
{%- set virtual_host_interface = 'eth0' %}
{%- endif %}
{%- if grains['provider'] in ['gcp', 'aws'] %}
{%- set virtual_host_mask = 32 %}
{%- else %}
{%- set virtual_host_mask = 24 %}
{%- endif %}
{%- set sid_lower = grains['netweaver_sid'].lower() %}
{%- set sid_upper = grains['netweaver_sid'].upper() %}
{%- set hana_sid_upper = grains['hana_sid'].upper() %}
{%- set hana_instance_number = '{:0>2}'.format(grains['hana_instance_number']) %}
{%- set product_id_header = grains['netweaver_product_id'].split(".")[0] %}
netweaver:
{%- set app_server_count = grains['app_server_count']|default(2) %}
{%- if not grains['ha_enabled'] %}
{%- set app_start_index = [app_server_count, 1]|min %}
{%- elif app_server_count == 0 %}
{%- set app_start_index = 0 %}
{%- else %}
{%- set app_start_index = 2 %}
{%- endif %}
virtual_addresses:
{{ grains['virtual_host_ips'][0] }}: sap{{ sid_lower }}as
{%- if grains['ha_enabled'] %}
{{ grains['virtual_host_ips'][1] }}: sap{{ sid_lower }}er
{{ grains['virtual_host_ips'][2] }}: sap{{ sid_lower }}pas
{%- else %}
{{ grains['virtual_host_ips'][1] }}: sap{{ sid_lower }}pas
{%- endif %}
{%- for index in range(app_server_count-1) %}
{{ grains['virtual_host_ips'][loop.index+app_start_index] }}: sap{{ sid_lower }}aas{{ loop.index }}
{%- endfor %}
sidadm_user:
uid: 2001
gid: 2002
sid_adm_password: {{ grains['netweaver_master_password'] }}
sap_adm_password: {{ grains['netweaver_master_password'] }}
master_password: {{ grains['netweaver_master_password'] }}
{%- if grains['provider'] == 'aws' and grains['netweaver_shared_storage_type'] == 'efs' %}
sapmnt_inst_media: "{{ grains['efs_mount_ip']['sapmnt'][0] }}:/"
{%- elif grains['provider'] == 'azure' and grains['netweaver_shared_storage_type'] == 'anf' %}
sapmnt_inst_media: "{{ grains['anf_mount_ip']['sapmnt'][0] }}:/netweaver-sapmnt"
{%- else %}
sapmnt_inst_media: "{{ grains['netweaver_nfs_share'] }}"
{%- endif %}
sapmnt_path: {{ grains['netweaver_sapmnt_path'] }}
{%- if grains.get('netweaver_swpm_folder', False) %}
swpm_folder: {{ grains['netweaver_inst_folder'] }}/{{ grains['netweaver_swpm_folder'] }}
{%- endif %}
{%- if grains.get('netweaver_swpm_sar', False) %}
swpm_sar_file: {{ grains['netweaver_inst_folder'] }}/{{ grains['netweaver_swpm_sar'] }}
{%- endif %}
{%- if grains.get('netweaver_sapcar_exe', False) %}
sapcar_exe_file: {{ grains['netweaver_inst_folder'] }}/{{ grains['netweaver_sapcar_exe'] }}
{%- endif %}
{%- if grains.get('netweaver_extract_dir', False) %}
nw_extract_dir: {{ grains['netweaver_extract_dir'] }}
{%- endif %}
sapexe_folder: {{ grains['netweaver_inst_folder'] }}/{{ grains['netweaver_sapexe_folder'] }}
additional_dvds: {%- if not grains['netweaver_additional_dvds'] %} []
{%- else %}
{%- for dvd in grains['netweaver_additional_dvds'] %}
- {{ grains['netweaver_inst_folder'] }}/{{ dvd }}
{%- endfor %}
{%- endif %}
# apply by default the netweaver solution
saptune_solution: 'NETWEAVER'
monitoring_enabled: {{ grains['monitoring_enabled']|default(False) }}
hana:
host: {{ grains['hana_ip'] }}
sid: {{ hana_sid_upper }}
instance: {{ hana_instance_number }}
password: {{ grains['hana_master_password'] }}
sr_enabled: {{ grains['hana_sr_enabled']|default(false) }}
schema:
{%- if product_id_header in ['S4HANA1809', 'S4HANA1909', 'S4HANA2020', 'S4HANA2021'] %}
name: SAPHANADB # This name is always used for new S/4HANA, so it shouldn't be changed
{%- else %}
name: SAPABAP1
{%- endif %}
password: {{ grains['netweaver_master_password'] }}
product_id: {{ grains['netweaver_product_id'] }}
{%- if grains['provider'] == 'aws' %}
nfs_options: rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2
{%- endif %}
ha_enabled: {{ grains['ha_enabled'] }}
nodes:
- host: {{ grains['name_prefix'] }}01
virtual_host: sap{{ sid_lower }}as
virtual_host_interface: {{ virtual_host_interface }}
virtual_host_mask: {{ virtual_host_mask }}
sid: {{ sid_upper }}
instance: {{ '{:0>2}'.format(grains['ascs_instance_number']) }}
root_user: root
root_password: linux
{%- if grains['ha_enabled'] and grains['provider'] == 'libvirt' %}
shared_disk_dev: /dev/vdb
init_shared_disk: True
{%- elif grains['ha_enabled'] %}
{%- if grains['provider'] == 'aws' and grains['netweaver_shared_storage_type'] == 'efs' %}
shared_disk_dev: {{ grains['efs_mount_ip']['sapmnt'][0] }}:/ASCS
{%- elif grains['provider'] == 'azure' and grains['netweaver_shared_storage_type'] == 'anf' %}
shared_disk_dev: {{ grains['anf_mount_ip']['sapmnt'][0] }}:/netweaver-sapmnt/ASCS
{%- elif grains['provider'] == 'openstack' and grains['netweaver_shared_storage_type'] == 'nfs' %}
shared_disk_dev: {{ grains['netweaver_nfs_share'] }}/ASCS{{ '{:0>2}'.format(grains['ascs_instance_number']) }}
{%- else %}
shared_disk_dev: {{ grains['netweaver_nfs_share'] }}/ASCS
{%- endif %}
{%- endif %}
sap_instance: ascs
{% if grains['ha_enabled'] %}
- host: {{ grains['name_prefix'] }}02
virtual_host: sap{{ sid_lower }}er
virtual_host_interface: {{ virtual_host_interface }}
virtual_host_mask: {{ virtual_host_mask }}
sid: {{ sid_upper }}
instance: {{ '{:0>2}'.format(grains['ers_instance_number']) }}
root_user: root
root_password: linux
{%- if grains['provider'] == 'libvirt' %}
shared_disk_dev: /dev/vdb
{%- else %}
{%- if grains['provider'] == 'aws' and grains['netweaver_shared_storage_type'] == 'efs' %}
shared_disk_dev: {{ grains['efs_mount_ip']['sapmnt'][0] }}:/ERS
{%- elif grains['provider'] == 'azure' and grains['netweaver_shared_storage_type'] == 'anf' %}
shared_disk_dev: {{ grains['anf_mount_ip']['sapmnt'][0] }}:/netweaver-sapmnt/ERS
{%- elif grains['provider'] == 'openstack' and grains['netweaver_shared_storage_type'] == 'nfs' %}
shared_disk_dev: {{ grains['netweaver_nfs_share'] }}/ERS{{ '{:0>2}'.format(grains['ers_instance_number']) }}
{%- else %}
shared_disk_dev: {{ grains['netweaver_nfs_share'] }}/ERS
{%- endif %}
{%- endif %}
sap_instance: ers
{% endif %}
- host: {{ grains['name_prefix'] }}0{{ app_start_index+1 }}
virtual_host: sap{{ sid_lower }}pas
virtual_host_interface: {{ virtual_host_interface }}
virtual_host_mask: {{ virtual_host_mask }}
sid: {{ sid_upper }}
instance: '99' # It is not used, but set a unique number to avoid conflicts on salt code
root_user: root
root_password: linux
sap_instance: db
- host: {{ grains['name_prefix'] }}0{{ app_start_index+1 }}
virtual_host: sap{{ sid_lower }}pas
virtual_host_interface: {{ virtual_host_interface }}
virtual_host_mask: {{ virtual_host_mask }}
ascs_virtual_host: sap{{ sid_lower }}as
sid: {{ sid_upper }}
instance: {{ '{:0>2}'.format(grains['pas_instance_number']) }}
root_user: root
root_password: linux
sap_instance: pas
{%- for index in range(app_server_count-1) %}
- host: {{ grains['name_prefix'] }}0{{ app_start_index+loop.index+1 }}
virtual_host: sap{{ sid_lower }}aas{{ loop.index }}
virtual_host_interface: {{ virtual_host_interface }}
virtual_host_mask: {{ virtual_host_mask }}
sid: {{ sid_upper }}
instance: {{ '{:0>2}'.format(grains['pas_instance_number']+loop.index) }}
root_user: root
root_password: linux
sap_instance: aas
{%- if product_id_header in ['S4HANA1709'] %}
attempts: 500
{%- endif %}
{% endfor %}