From 291c75c13104f7bf15b770265964839f95a1d9ab Mon Sep 17 00:00:00 2001 From: Eike Waldt Date: Thu, 11 Nov 2021 16:10:12 +0100 Subject: [PATCH 1/7] use multi-target Hook on HANA scale-out and use sudoers.d file --- hana/ha_cluster.sls | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hana/ha_cluster.sls b/hana/ha_cluster.sls index c4cf645..523e7e9 100644 --- a/hana/ha_cluster.sls +++ b/hana/ha_cluster.sls @@ -126,8 +126,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,8 +162,9 @@ 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 %} From c7daf6b86bf93960d3a8833ead3eb68c1a79ee87 Mon Sep 17 00:00:00 2001 From: Eike Waldt Date: Mon, 28 Mar 2022 13:15:20 +0200 Subject: [PATCH 2/7] allow to disable shared HANA basepath and rework add_hosts code --- hana/install.sls | 62 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/hana/install.sls b/hana/install.sls index 47f52d4..5a71084 100644 --- a/hana/install.sls +++ b/hana/install.sls @@ -8,6 +8,17 @@ include: {% for node in hana.nodes if node.host == host and 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 }} @@ -27,10 +38,57 @@ 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 %} + - 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 + +hana_add_hosts_pwd_file_remove_{{ node.host+node.sid }}: + file.absent: + - name: /root/hdb_passwords.xml + +{% endif %} +{% endfor %} {% endfor %} From 442e68ceaeeb5a75dcdd04ec2a3d06651b97fbee Mon Sep 17 00:00:00 2001 From: Eike Waldt Date: Mon, 28 Mar 2022 14:03:40 +0200 Subject: [PATCH 3/7] make sure /hana/{data,log}/${SID} exists on nodes where install does not run --- hana/install.sls | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/hana/install.sls b/hana/install.sls index 5a71084..5763705 100644 --- a/hana/install.sls +++ b/hana/install.sls @@ -6,7 +6,8 @@ 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) %} @@ -18,7 +19,6 @@ include: {%set extra_parameters_items = [] %} {% endif %} - hana_install_{{ node.host+node.sid }}: hana.installed: - name: {{ node.sid }} @@ -91,4 +91,24 @@ hana_add_hosts_pwd_file_remove_{{ node.host+node.sid }}: {% endif %} {% endfor %} +{% 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 + - group: sapsys + - mode: 750 + - makedirs: True + +create_hana_log_{{ node.sid.upper() }}: + file.directory: + - name: /hana/log/{{ node.sid.upper() }} + - user: {{ node.sid.lower() }}adm + - group: sapsys + - mode: 750 + - makedirs: True + +{% endif %} {% endfor %} From 2714fb115f096fd3f38bd7399bd593155ca18379 Mon Sep 17 00:00:00 2001 From: Eike Waldt Date: Mon, 28 Mar 2022 16:53:56 +0200 Subject: [PATCH 4/7] fix /hana/{data,log}/${SID} permissions --- hana/install.sls | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hana/install.sls b/hana/install.sls index 5763705..8b3e63a 100644 --- a/hana/install.sls +++ b/hana/install.sls @@ -97,16 +97,16 @@ hana_add_hosts_pwd_file_remove_{{ node.host+node.sid }}: create_hana_data_{{ node.sid.upper() }}: file.directory: - name: /hana/data/{{ node.sid.upper() }} - - user: {{ node.sid.lower() }}adm - - group: sapsys + # - 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 - - group: sapsys + # - user: {{ node.sid.lower() }}adm # user might not exist yet + # - group: sapsys # group might not exist yet - mode: 750 - makedirs: True From 20ebf5362650593e3037bb527be0cd2085487eb9 Mon Sep 17 00:00:00 2001 From: Eike Waldt Date: Tue, 29 Mar 2022 10:49:31 +0200 Subject: [PATCH 5/7] do not edit global.ini directly (if not needed) --- hana/enable_cost_optimized.sls | 30 +++++++++++++++++++++--------- hana/ha_cluster.sls | 27 +++++++++++++++++---------- 2 files changed, 38 insertions(+), 19 deletions(-) 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 523e7e9..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: @@ -169,16 +168,24 @@ remove_wrong_ha_hook_{{ sap_instance }}_options: # 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: From 526cd02b8b56b23d83ce4d37844494a2bcb31eb0 Mon Sep 17 00:00:00 2001 From: Eike Waldt Date: Tue, 29 Mar 2022 13:40:36 +0200 Subject: [PATCH 6/7] bump version to 0.10.0 --- _service | 2 +- saphanabootstrap-formula.changes | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/_service b/_service index 2f57625..3edaead 100644 --- a/_service +++ b/_service @@ -4,7 +4,7 @@ git .git saphanabootstrap-formula - 0.9.0+git.%ct.%h + 0.9.1+git.%ct.%h %%VERSION%% diff --git a/saphanabootstrap-formula.changes b/saphanabootstrap-formula.changes index 1bd9586..42ec73a 100644 --- a/saphanabootstrap-formula.changes +++ b/saphanabootstrap-formula.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +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 + * fix majority_maker code on case grain is empty + ------------------------------------------------------------------- Thu Nov 17 13:52:34 UTC 2021 - Eike Waldt From 04e0fdfb9405a7d12761263a08742d4af36c20ac Mon Sep 17 00:00:00 2001 From: Eike Waldt Date: Fri, 13 May 2022 09:31:45 +0200 Subject: [PATCH 7/7] fix removal condition for pwd_File --- hana/install.sls | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hana/install.sls b/hana/install.sls index 8b3e63a..a009a96 100644 --- a/hana/install.sls +++ b/hana/install.sls @@ -45,6 +45,7 @@ hana_install_{{ node.host+node.sid }}: {% endif %} {% endfor %} {% endif %} + # needed to utilize pwd file for add_hosts - remove_pwd_files: False # scale-out specific @@ -84,13 +85,14 @@ hana_add_hosts_{{ node.host+node.sid }}: - 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 -{% endif %} -{% endfor %} - {% else %} # node.install not defined # make sure /hana/{data,log}/${SID} exists on nodes where install does not run