diff --git a/hana/enable_cost_optimized.sls b/hana/enable_cost_optimized.sls index 0f1beb4..d410c1e 100644 --- a/hana/enable_cost_optimized.sls +++ b/hana/enable_cost_optimized.sls @@ -54,15 +54,27 @@ failure: {% endif %} configure_ha_dr_provider_srCostOptMemConfig: - ini.options_present: - - name: /hana/shared/{{ node.sid.upper() }}/global/hdb/custom/config/global.ini - - separator: '=' - - strict: False # do not touch rest of file - - sections: - ha_dr_provider_srCostOptMemConfig: - provider: 'srCostOptMemConfig' - path: '/hana/shared/srHook' - execution_order: '2' + module.run: + - hana.set_ini_parameter: + - ini_parameter_values: + - section_name: 'ha_dr_provider_srCostOptMemConfig' + parameter_name: 'provider' + parameter_value: 'srCostOptMemConfig' + - section_name: 'ha_dr_provider_srCostOptMemConfig' + parameter_name: 'path' + parameter_value: '/hana/shared/srHook' + - section_name: 'ha_dr_provider_srCostOptMemConfig' + parameter_name: 'execution_order' + parameter_value: '2' + - 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 }} - require: - reduce_memory_resources_{{ node.host+node.sid }} - setup_srHook_directory diff --git a/hana/ha_cluster.sls b/hana/ha_cluster.sls index c4cf645..43a779f 100644 --- a/hana/ha_cluster.sls +++ b/hana/ha_cluster.sls @@ -80,9 +80,8 @@ sudoers_remove_old_entries_{{ sap_instance }}_srHook: - repl: '' # Add SAPHANASR hook -# It would be better to get the text from /usr/share/SAPHanaSR/samples/global.ini -# only add hook and stop/start if hana was installed (not on scale-out standby/workers) +# Only add hook if hana was installed (not on scale-out standby/workers). A restart is needed as secondary cannot register a new hook without this (e.g. via hdbsql). {% if node.install is defined %} configure_ha_hook_{{ sap_instance }}_multi_target: ini.options_present: @@ -126,8 +125,9 @@ remove_wrong_ha_hook_{{ sap_instance }}_sections_multi_target: ha_dr_provider_SAPHanaSR: - require: - pkg: install_SAPHanaSR - - onlyif: - - test -f {{ sr_hook_multi_target }} + - unless: + - fun: file.file_exists + path: sr_hook_multi_target remove_wrong_ha_hook_{{ sap_instance }}_options_multi_target: ini.options_absent: @@ -161,22 +161,31 @@ remove_wrong_ha_hook_{{ sap_instance }}_options: - ha_dr_saphanasrmultitarget - require: - pkg: install_SAPHanaSR - - unless: - - test -f {{ sr_hook_multi_target }} + - onlyif: + - fun: file.file_exists + path: sr_hook_multi_target # Configure system replication operation mode in the primary site {% for secondary_node in hana.nodes if node.primary is defined and secondary_node.secondary is defined and secondary_node.secondary.remote_host == host %} configure_replication_{{ sap_instance }}: - ini.options_present: - - name: /hana/shared/{{ node.sid.upper() }}/global/hdb/custom/config/global.ini - - separator: '=' - - strict: False # do not touch rest of file - - sections: - system_replication: - operation_mode: '{{ secondary_node.secondary.operation_mode }}' + module.run: + - hana.set_ini_parameter: + - ini_parameter_values: + - section_name: 'system_replication' + parameter_name: 'operation_mode' + parameter_value: '{{ secondary_node.secondary.operation_mode }}' + - 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 }} {% endfor %} -# Stop SAP Hana +# Stop SAP Hana - Only needed if global.ini was edited directelly (removed old hooks). stop_hana_{{ sap_instance }}: module.run: - hana.stop: diff --git a/hana/install.sls b/hana/install.sls index 47f52d4..a009a96 100644 --- a/hana/install.sls +++ b/hana/install.sls @@ -6,7 +6,18 @@ include: - .enable_cost_optimized -{% for node in hana.nodes if node.host == host and node.install is defined %} +{% 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: @@ -27,10 +38,79 @@ hana_install_{{ node.host+node.sid }}: {% endif %} - extra_parameters: - hostname: {{ node.host }} - {% if node.install.extra_parameters is defined and node.install.extra_parameters|length > 0 %} - {% for key,value in node.install.extra_parameters.items() %} + {% 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 %} diff --git a/saphanabootstrap-formula.changes b/saphanabootstrap-formula.changes index a5c6ccd..b43a856 100644 --- a/saphanabootstrap-formula.changes +++ b/saphanabootstrap-formula.changes @@ -1,4 +1,13 @@ ------------------------------------------------------------------- +Thu May 13 08:16:24 UTC 2022 - Eike Waldt + +- Version bump 0.10.0 + * allow to disable shared HANA basepath and rework add_hosts code + (enables HANA scale-out on AWS) + * do not edit global.ini directly (if not needed) + +------------------------------------------------------------------- + Thu May 05 20:18:52 UTC 2022 - Eike Waldt - Version bump 0.9.1