-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathinstall.sls
116 lines (103 loc) · 3.81 KB
/
install.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
{%- from "hana/map.jinja" import hana with context -%}
{%- from 'hana/macros/get_hana_exe_extract_dir.sls' import get_hana_exe_extract_dir with context %}
{% set host = grains['host'] %}
{% set hana_extract_dir = get_hana_exe_extract_dir(hana) %}
include:
- .enable_cost_optimized
{% for node in hana.nodes if node.host == host %}
{% if node.install is defined %}
{% set instance = '{:0>2}'.format(node.instance) %}
{% set sap_instance = '{}_{}'.format(node.sid, instance) %}
{% if node.install.extra_parameters is defined and node.install.extra_parameters|length > 0 %}
{%set extra_parameters = True %}
{%set extra_parameters_items = node.install.extra_parameters.items() %}
{% else %}
{%set extra_parameters = False %}
{%set extra_parameters_items = [] %}
{% endif %}
hana_install_{{ node.host+node.sid }}:
hana.installed:
- name: {{ node.sid }}
- inst: {{ node.instance }}
- password: {{ node.password }}
- software_path: {{ node.install.software_path|default(hana.software_path)|default(hana_extract_dir) }}
- root_user: {{ node.install.root_user }}
- root_password: {{ node.install.root_password }}
{% if node.install.config_file is defined %}
- config_file: {{ node.install.config_file }}
{% endif %}
{% if node.install.hdb_pwd_file is defined %}
- hdb_pwd_file: {{ node.install.hdb_pwd_file }}
{% else %}
- system_user_password: {{ node.install.system_user_password }}
- sapadm_password: {{ node.install.sapadm_password }}
{% endif %}
- extra_parameters:
- hostname: {{ node.host }}
{% if extra_parameters %}
{% for key,value in extra_parameters_items %}
{% if key != 'addhosts' %} # exclude addhosts (scale-out)
- {{ key }}: {{ value }}
{% endif %}
{% endfor %}
{% endif %}
# needed to utilize pwd file for add_hosts
- remove_pwd_files: False
# scale-out specific
{% for key,value in extra_parameters_items %}
{% if key == 'addhosts' %}
# SAP Note 2080991
{% if not hana.basepath_shared|default(True) %}
disable_basepath_shared_{{ sap_instance }}:
module.run:
- hana.set_ini_parameter:
- ini_parameter_values:
- section_name: 'persistence'
parameter_name: 'basepath_shared'
parameter_value: 'no'
- database: SYSTEMDB
- file_name: global.ini
- layer: SYSTEM
- reconfig: True
- user_name: SYSTEM
- user_password: {{ node.password }}
- password: {{ node.password }}
- sid: {{ node.sid }}
- inst: {{ node.instance }}
{% endif %}
# add scale-out nodes
hana_add_hosts_{{ node.host+node.sid }}:
module.run:
- hana.add_hosts:
- add_hosts: {{ value }}
- hdblcm_folder: /hana/shared/{{ node.sid.upper() }}/hdblcm
- root_user: {{ node.install.root_user }}
- root_password: {{ node.install.root_password }}
- hdb_pwd_file: /root/hdb_passwords.xml
# only run after initial install (password file still exists)
- onlyif:
- test -f /root/hdb_passwords.xml
{% endif %}
{% endfor %}
# see "remove_pwd_files: False" above
hana_add_hosts_pwd_file_remove_{{ node.host+node.sid }}:
file.absent:
- name: /root/hdb_passwords.xml
{% else %} # node.install not defined
# make sure /hana/{data,log}/${SID} exists on nodes where install does not run
create_hana_data_{{ node.sid.upper() }}:
file.directory:
- name: /hana/data/{{ node.sid.upper() }}
# - user: {{ node.sid.lower() }}adm # user might not exist yet
# - group: sapsys # group might not exist yet
- mode: 750
- makedirs: True
create_hana_log_{{ node.sid.upper() }}:
file.directory:
- name: /hana/log/{{ node.sid.upper() }}
# - user: {{ node.sid.lower() }}adm # user might not exist yet
# - group: sapsys # group might not exist yet
- mode: 750
- makedirs: True
{% endif %}
{% endfor %}