From 9663419e63223f9fcd6b9ad4c011294f84f2698a Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 10 Sep 2021 14:23:20 +0200 Subject: [PATCH 01/23] solve issue #22 --- files/tmp/tail-f-hdblcm-trc.sh | 11 +++++++++++ tasks/hana_deploy.yml | 15 +++++++++++++++ 2 files changed, 26 insertions(+) create mode 100755 files/tmp/tail-f-hdblcm-trc.sh diff --git a/files/tmp/tail-f-hdblcm-trc.sh b/files/tmp/tail-f-hdblcm-trc.sh new file mode 100755 index 0000000..6d36645 --- /dev/null +++ b/files/tmp/tail-f-hdblcm-trc.sh @@ -0,0 +1,11 @@ +#/bin/bash + +_HDBLCM_PID=$(ps -ef | awk '/hdblcm/&&/instlog_dir/&&!/awk/{print $2}') + +if [[ ${_HDBLCM_PID}. != "." ]]; then + _HDBLCM_TRC_FILE=/var/tmp/hdblcm_$(ps -ef | grep hdblcm | awk 'BEGIN{RS=" "}/instlog_dir/{split ($0, a, "install_"); print a[2]}')*.trc + echo "hdblcm trace file: ${_HDBLCM_TRC_FILE}" + tail -100f ${_HDBLCM_TRC_FILE} +else + echo "No hdblcm process found." +fi diff --git a/tasks/hana_deploy.yml b/tasks/hana_deploy.yml index 9dc9bd9..9dcf523 100644 --- a/tasks/hana_deploy.yml +++ b/tasks/hana_deploy.yml @@ -52,6 +52,21 @@ dest: "{{ tmpdir.path }}/configfile.cfg" register: cftemplate +- name: Copy file /tmp/tail-f-hdblcm-trc.sh + copy: + src: tmp/tail-f-hdblcm-trc.sh + dest: /tmp/tail-f-hdblcm-trc.sh + owner: root + group: root + mode: '0755' + +- name: Show how to watch the installation process in real time + debug: + msg: + - 'Once the task "Install SAP HANA" has started, you can use the following command in + in another terminal to watch the installation progress in real time:' + - ssh {{ inventory_hostname }} /tmp/tail-f-hdblcm-trc.sh + - name: Install SAP HANA command: "./hdblcm {{ sap_hana_deployment_hdblcm_extraargs }} --configfile={{ tmpdir.path }}/configfile.cfg -b" register: installhana From 091603feca3eb2710425dc1d2217b5d232202a67 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 10 Sep 2021 15:24:17 +0200 Subject: [PATCH 02/23] Solve issue #21. --- README.md | 7 +++-- defaults/main.yml | 5 ++++ tasks/hana_deploy.yml | 64 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 72 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5ec5a92..37b32d0 100644 --- a/README.md +++ b/README.md @@ -34,14 +34,15 @@ It is also important that your disks are setup according to the [SAP storage req | variable | info | required? | |:--------:|:----------------------------:|:---------:| -|sap_hana_installdir| directory, where hdblcm is located | No, if `sap_hana_deployment_bundle_path`, `sap_hana_deployment_bundle_sar_file_name`, `sap_hana_deployment_sapcar_path` and `sap_hana_deployment_sapcar_file_name` or `sap_hana_deployment_zip_path` and `sap_hana_deployment_zip_file_name` are defined.| +|sap_hana_deployment_set_permissions| set or verify correct permissions of 0755 for /hana/shared, /hana/data, /hana/log, and /usr/sap. If set to `yes`, permissions will be set. If set to `no`, permissions will be verified and the role will abort if one of the permissions is not set correctly. | Yes. Default is `no`.| +|sap_hana_installdir| directory where hdblcm is located |No, if `sap_hana_deployment_bundle_path`, `sap_hana_deployment_bundle_sar_file_name`, `sap_hana_deployment_sapcar_path` and `sap_hana_deployment_sapcar_file_name` or `sap_hana_deployment_zip_path` and `sap_hana_deployment_zip_file_name` are defined.| |sap_hana_deployment_bundle_path|Target host directory path where SAP HANA Installation Bundle SAR file is located|yes, unless `sap_hana_installdir` is defined| |sap_hana_deployment_bundle_sar_file_name|Installation Bundle SAR file name|yes, unless `sap_hana_installdir` is defined| |sap_hana_deployment_zip_path|Target host directory path where SAP HANA Installation Bundle ZIP file is located|No, if `sap_hana_installdir` or `sap_hana_deployment_bundle_path`, `sap_hana_deployment_bundle_sar_file_name`, `sap_hana_deployment_sapcar_path` and `sap_hana_deployment_sapcar_file_name` are defined| |sap_hana_deployment_zip_file_name|Installation Bundle ZIP file name|No, if `sap_hana_installdir` or `sap_hana_deployment_bundle_path`, `sap_hana_deployment_bundle_sar_file_name`, `sap_hana_deployment_sapcar_path` and `sap_hana_deployment_sapcar_file_name` are defined| |sap_hana_deployment_sapcar_path|Target host directory directory path where SAPCAR tool file is located|yes, unless `sap_hana_installdir` is defined| -|sap_hana_deployment_sapcar_file_name|SAPCAR tool file name|yes, unless `sap_hana_installdir` is defined| -|sap_hana_deployment_hdblcm_extraargs| define extra commandline arguments to hdblcm, such as `--ignore=check1[,check2]` | No | +|sap_hana_deployment_sapcar_file_name|SAPCAR tool file name|Yes, unless `sap_hana_installdir` is defined| +|sap_hana_deployment_hdblcm_extraargs|Define extra commandline arguments to hdblcm, such as `--ignore=check1[,check2]` | No | |sap_hana_deployment_deploy_hostagent|Whatever you want to deploy SAP HostAgent or not|no, defaulted to `n` value| |sap_hana_deployment_use_master_password|Use single master password for all users, created during installation|no, defaulted to `n` value| |sap_hana_deployment_common_master_password|Common password for both OS users and DB Administrator user (SYSTEM)|no, only if sap_hana_deployment_use_master_password is `y`| diff --git a/defaults/main.yml b/defaults/main.yml index 7745c75..e377cbf 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,11 @@ # Global Default variables # Adapt to your default settings +# If the following variable is set to 'yes', set permissions of +# /hana/shared, /hana/data, /hana/log, and /usr/sap to 0755. +# If the variable is set to 'no', verify the permissions. +sap_hana_deployment_set_permissions: no + # Target host path and file name for the bundle installation file sap_hana_deployment_bundle_path: sap_hana_deployment_bundle_sar_file_name: diff --git a/tasks/hana_deploy.yml b/tasks/hana_deploy.yml index 9dcf523..e9772f4 100644 --- a/tasks/hana_deploy.yml +++ b/tasks/hana_deploy.yml @@ -1,5 +1,67 @@ --- +- name: Set permissions of installation directories to 0755 + file: + path: "{{ line_item }}" + state: directory + mode: 0755 + loop: + - /hana/shared + - /hana/data + - /hana/log + - /usr/sap + loop_control: + loop_var: line_item + when: sap_hana_deployment_set_permissions + +- name: Assert correct permissions of installation directories + block: + - name: Get permissions of /hana/shared + stat: + path: /hana/shared + register: __sap_hana_deployment_register_stat_hana_shared + + - name: Assert that permissions for /hana/shared are correct + assert: + that: __sap_hana_deployment_register_stat_hana_shared.stat.mode == '0755' + fail_msg: "FAIL: /hana/shared has permissions {{ __sap_hana_deployment_register_stat_hana_shared.stat.mode }} but needs to have '0755'!" + success_msg: "PASS: /hana/shared has correct permissions: {{ __sap_hana_deployment_register_stat_hana_shared.stat.mode }}." + + - name: Get permissions of /hana/data + stat: + path: /hana/shared + register: __sap_hana_deployment_register_stat_hana_data + + - name: Assert that permissions for /hana/data are correct + assert: + that: __sap_hana_deployment_register_stat_hana_data.stat.mode == '0755' + fail_msg: "FAIL: /hana/data has permissions {{ __sap_hana_deployment_register_stat_hana_data.stat.mode }} but needs to have '0755'!" + success_msg: "PASS: /hana/data has correct permissions: {{ __sap_hana_deployment_register_stat_hana_data.stat.mode }}." + + - name: Get permissions of /hana/log + stat: + path: /hana/log + register: __sap_hana_deployment_register_stat_hana_log + + - name: Assert that permissions for /hana/log are correct + assert: + that: __sap_hana_deployment_register_stat_hana_log.stat.mode == '0755' + fail_msg: "FAIL: /hana/log has permissions {{ __sap_hana_deployment_register_stat_hana_log.stat.mode }} but needs to have '0755'!" + success_msg: "PASS: /hana/log has correct permissions: {{ __sap_hana_deployment_register_stat_hana_log.stat.mode }}." + + - name: Get permissions of /usr/sap + stat: + path: /usr/sap + register: __sap_hana_deployment_register_stat_usr_sap + + - name: Assert that permissions for /usr/sap are correct + assert: + that: __sap_hana_deployment_register_stat_usr_sap.stat.mode == '0755' + fail_msg: "FAIL: /usr/sap has permissions {{ __sap_hana_deployment_register_stat_usr_sap.stat.mode }} but needs to have '0755'!" + success_msg: "PASS: /usr/sap has correct permissions: {{ __sap_hana_deployment_register_stat_usr_sap.stat.mode }}." + + when: not sap_hana_deployment_set_permissions + - name: Unpack SAPCAR archive (backwards compatibility) block: - name: Use SAPCAR to extract the SAP HANA Bundle SAR file @@ -40,7 +102,7 @@ register: sap_hana_deployment_register_hdblcm_stat failed_when: not sap_hana_deployment_register_hdblcm_stat.stat.exists -- name: create temporary directory to store the processed template +- name: Create temporary directory to store the processed template tempfile: state: directory suffix: hanaconfig From d45f5a23d0769e7717ca358f496f321ba92d988c Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 10 Sep 2021 14:23:20 +0200 Subject: [PATCH 03/23] solve issue #22 --- files/tmp/tail-f-hdblcm-trc.sh | 11 +++++++++++ tasks/hana_deploy.yml | 15 +++++++++++++++ 2 files changed, 26 insertions(+) create mode 100755 files/tmp/tail-f-hdblcm-trc.sh diff --git a/files/tmp/tail-f-hdblcm-trc.sh b/files/tmp/tail-f-hdblcm-trc.sh new file mode 100755 index 0000000..6d36645 --- /dev/null +++ b/files/tmp/tail-f-hdblcm-trc.sh @@ -0,0 +1,11 @@ +#/bin/bash + +_HDBLCM_PID=$(ps -ef | awk '/hdblcm/&&/instlog_dir/&&!/awk/{print $2}') + +if [[ ${_HDBLCM_PID}. != "." ]]; then + _HDBLCM_TRC_FILE=/var/tmp/hdblcm_$(ps -ef | grep hdblcm | awk 'BEGIN{RS=" "}/instlog_dir/{split ($0, a, "install_"); print a[2]}')*.trc + echo "hdblcm trace file: ${_HDBLCM_TRC_FILE}" + tail -100f ${_HDBLCM_TRC_FILE} +else + echo "No hdblcm process found." +fi diff --git a/tasks/hana_deploy.yml b/tasks/hana_deploy.yml index 9dc9bd9..9dcf523 100644 --- a/tasks/hana_deploy.yml +++ b/tasks/hana_deploy.yml @@ -52,6 +52,21 @@ dest: "{{ tmpdir.path }}/configfile.cfg" register: cftemplate +- name: Copy file /tmp/tail-f-hdblcm-trc.sh + copy: + src: tmp/tail-f-hdblcm-trc.sh + dest: /tmp/tail-f-hdblcm-trc.sh + owner: root + group: root + mode: '0755' + +- name: Show how to watch the installation process in real time + debug: + msg: + - 'Once the task "Install SAP HANA" has started, you can use the following command in + in another terminal to watch the installation progress in real time:' + - ssh {{ inventory_hostname }} /tmp/tail-f-hdblcm-trc.sh + - name: Install SAP HANA command: "./hdblcm {{ sap_hana_deployment_hdblcm_extraargs }} --configfile={{ tmpdir.path }}/configfile.cfg -b" register: installhana From 1ea284296125142f0e3356b5965d2281f9f28bf7 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 10 Sep 2021 15:24:17 +0200 Subject: [PATCH 04/23] Solve issue #21. --- README.md | 7 +++-- defaults/main.yml | 5 ++++ tasks/hana_deploy.yml | 64 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 72 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 09101b9..9aba0ee 100644 --- a/README.md +++ b/README.md @@ -34,14 +34,15 @@ It is also important that your disks are setup according to the [SAP storage req | variable | info | required? | |:--------:|:----------------------------:|:---------:| -|sap_hana_installdir| directory, where hdblcm is located | No, if `sap_hana_deployment_bundle_path`, `sap_hana_deployment_bundle_sar_file_name`, `sap_hana_deployment_sapcar_path` and `sap_hana_deployment_sapcar_file_name` or `sap_hana_deployment_zip_path` and `sap_hana_deployment_zip_file_name` are defined.| +|sap_hana_deployment_set_permissions| set or verify correct permissions of 0755 for /hana/shared, /hana/data, /hana/log, and /usr/sap. If set to `yes`, permissions will be set. If set to `no`, permissions will be verified and the role will abort if one of the permissions is not set correctly. | Yes. Default is `no`.| +|sap_hana_installdir| directory where hdblcm is located |No, if `sap_hana_deployment_bundle_path`, `sap_hana_deployment_bundle_sar_file_name`, `sap_hana_deployment_sapcar_path` and `sap_hana_deployment_sapcar_file_name` or `sap_hana_deployment_zip_path` and `sap_hana_deployment_zip_file_name` are defined.| |sap_hana_deployment_bundle_path|Target host directory path where SAP HANA Installation Bundle SAR file is located|yes, unless `sap_hana_installdir` is defined| |sap_hana_deployment_bundle_sar_file_name|Installation Bundle SAR file name|yes, unless `sap_hana_installdir` is defined| |sap_hana_deployment_zip_path|Target host directory path where SAP HANA Installation Bundle ZIP file is located|No, if `sap_hana_installdir` or `sap_hana_deployment_bundle_path`, `sap_hana_deployment_bundle_sar_file_name`, `sap_hana_deployment_sapcar_path` and `sap_hana_deployment_sapcar_file_name` are defined| |sap_hana_deployment_zip_file_name|Installation Bundle ZIP file name|No, if `sap_hana_installdir` or `sap_hana_deployment_bundle_path`, `sap_hana_deployment_bundle_sar_file_name`, `sap_hana_deployment_sapcar_path` and `sap_hana_deployment_sapcar_file_name` are defined| |sap_hana_deployment_sapcar_path|Target host directory directory path where SAPCAR tool file is located|yes, unless `sap_hana_installdir` is defined| -|sap_hana_deployment_sapcar_file_name|SAPCAR tool file name|yes, unless `sap_hana_installdir` is defined| -|sap_hana_deployment_hdblcm_extraargs| define extra commandline arguments to hdblcm, such as `--ignore=check1[,check2]` | No | +|sap_hana_deployment_sapcar_file_name|SAPCAR tool file name|Yes, unless `sap_hana_installdir` is defined| +|sap_hana_deployment_hdblcm_extraargs|Define extra commandline arguments to hdblcm, such as `--ignore=check1[,check2]` | No | |sap_hana_deployment_deploy_hostagent|Whatever you want to deploy SAP HostAgent or not|no, defaulted to `n` value| |sap_hana_deployment_use_master_password|Use single master password for all users, created during installation|no, defaulted to `n` value| |sap_hana_deployment_common_master_password|Common password for both OS users and DB Administrator user (SYSTEM)|no, only if sap_hana_deployment_use_master_password is `y`| diff --git a/defaults/main.yml b/defaults/main.yml index 7745c75..e377cbf 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,11 @@ # Global Default variables # Adapt to your default settings +# If the following variable is set to 'yes', set permissions of +# /hana/shared, /hana/data, /hana/log, and /usr/sap to 0755. +# If the variable is set to 'no', verify the permissions. +sap_hana_deployment_set_permissions: no + # Target host path and file name for the bundle installation file sap_hana_deployment_bundle_path: sap_hana_deployment_bundle_sar_file_name: diff --git a/tasks/hana_deploy.yml b/tasks/hana_deploy.yml index 9dcf523..e9772f4 100644 --- a/tasks/hana_deploy.yml +++ b/tasks/hana_deploy.yml @@ -1,5 +1,67 @@ --- +- name: Set permissions of installation directories to 0755 + file: + path: "{{ line_item }}" + state: directory + mode: 0755 + loop: + - /hana/shared + - /hana/data + - /hana/log + - /usr/sap + loop_control: + loop_var: line_item + when: sap_hana_deployment_set_permissions + +- name: Assert correct permissions of installation directories + block: + - name: Get permissions of /hana/shared + stat: + path: /hana/shared + register: __sap_hana_deployment_register_stat_hana_shared + + - name: Assert that permissions for /hana/shared are correct + assert: + that: __sap_hana_deployment_register_stat_hana_shared.stat.mode == '0755' + fail_msg: "FAIL: /hana/shared has permissions {{ __sap_hana_deployment_register_stat_hana_shared.stat.mode }} but needs to have '0755'!" + success_msg: "PASS: /hana/shared has correct permissions: {{ __sap_hana_deployment_register_stat_hana_shared.stat.mode }}." + + - name: Get permissions of /hana/data + stat: + path: /hana/shared + register: __sap_hana_deployment_register_stat_hana_data + + - name: Assert that permissions for /hana/data are correct + assert: + that: __sap_hana_deployment_register_stat_hana_data.stat.mode == '0755' + fail_msg: "FAIL: /hana/data has permissions {{ __sap_hana_deployment_register_stat_hana_data.stat.mode }} but needs to have '0755'!" + success_msg: "PASS: /hana/data has correct permissions: {{ __sap_hana_deployment_register_stat_hana_data.stat.mode }}." + + - name: Get permissions of /hana/log + stat: + path: /hana/log + register: __sap_hana_deployment_register_stat_hana_log + + - name: Assert that permissions for /hana/log are correct + assert: + that: __sap_hana_deployment_register_stat_hana_log.stat.mode == '0755' + fail_msg: "FAIL: /hana/log has permissions {{ __sap_hana_deployment_register_stat_hana_log.stat.mode }} but needs to have '0755'!" + success_msg: "PASS: /hana/log has correct permissions: {{ __sap_hana_deployment_register_stat_hana_log.stat.mode }}." + + - name: Get permissions of /usr/sap + stat: + path: /usr/sap + register: __sap_hana_deployment_register_stat_usr_sap + + - name: Assert that permissions for /usr/sap are correct + assert: + that: __sap_hana_deployment_register_stat_usr_sap.stat.mode == '0755' + fail_msg: "FAIL: /usr/sap has permissions {{ __sap_hana_deployment_register_stat_usr_sap.stat.mode }} but needs to have '0755'!" + success_msg: "PASS: /usr/sap has correct permissions: {{ __sap_hana_deployment_register_stat_usr_sap.stat.mode }}." + + when: not sap_hana_deployment_set_permissions + - name: Unpack SAPCAR archive (backwards compatibility) block: - name: Use SAPCAR to extract the SAP HANA Bundle SAR file @@ -40,7 +102,7 @@ register: sap_hana_deployment_register_hdblcm_stat failed_when: not sap_hana_deployment_register_hdblcm_stat.stat.exists -- name: create temporary directory to store the processed template +- name: Create temporary directory to store the processed template tempfile: state: directory suffix: hanaconfig From e67df906bf05dd6fe9b4d62217e82e9626347a80 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Sun, 17 Oct 2021 00:21:31 +0200 Subject: [PATCH 05/23] Solve issues #36, #37, and #38 --- README.md | 22 ++- defaults/main.yml | 65 +++++-- ...ectories-permissions-assert-loop-block.yml | 14 ++ tasks/hana_deploy.yml | 161 ++++++++++-------- 4 files changed, 165 insertions(+), 97 deletions(-) create mode 100644 tasks/directories-permissions-assert-loop-block.yml diff --git a/README.md b/README.md index 9aba0ee..2530c48 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This role installs SAP HANA on a RHEL 7.x or 8.x system and applies a permament ## Requirements -This role is intended to use on a RHEL system that gets SAP software. +This role is intended to be used on a RHEL system on which SAP HANA software is to be installed. So your system needs to be installed with at least the RHEL core packages, properly registered and prepared for HANA or Netweaver installation. It needs access to the software repositories required to install SAP HANA (see also: [How to subscribe SAP HANA systems to the Update Services for SAP Solutions](https://access.redhat.com/solutions/3075991)) @@ -34,14 +34,18 @@ It is also important that your disks are setup according to the [SAP storage req | variable | info | required? | |:--------:|:----------------------------:|:---------:| -|sap_hana_deployment_set_permissions| set or verify correct permissions of 0755 for /hana/shared, /hana/data, /hana/log, and /usr/sap. If set to `yes`, permissions will be set. If set to `no`, permissions will be verified and the role will abort if one of the permissions is not set correctly. | Yes. Default is `no`.| -|sap_hana_installdir| directory where hdblcm is located |No, if `sap_hana_deployment_bundle_path`, `sap_hana_deployment_bundle_sar_file_name`, `sap_hana_deployment_sapcar_path` and `sap_hana_deployment_sapcar_file_name` or `sap_hana_deployment_zip_path` and `sap_hana_deployment_zip_file_name` are defined.| -|sap_hana_deployment_bundle_path|Target host directory path where SAP HANA Installation Bundle SAR file is located|yes, unless `sap_hana_installdir` is defined| -|sap_hana_deployment_bundle_sar_file_name|Installation Bundle SAR file name|yes, unless `sap_hana_installdir` is defined| -|sap_hana_deployment_zip_path|Target host directory path where SAP HANA Installation Bundle ZIP file is located|No, if `sap_hana_installdir` or `sap_hana_deployment_bundle_path`, `sap_hana_deployment_bundle_sar_file_name`, `sap_hana_deployment_sapcar_path` and `sap_hana_deployment_sapcar_file_name` are defined| -|sap_hana_deployment_zip_file_name|Installation Bundle ZIP file name|No, if `sap_hana_installdir` or `sap_hana_deployment_bundle_path`, `sap_hana_deployment_bundle_sar_file_name`, `sap_hana_deployment_sapcar_path` and `sap_hana_deployment_sapcar_file_name` are defined| -|sap_hana_deployment_sapcar_path|Target host directory directory path where SAPCAR tool file is located|yes, unless `sap_hana_installdir` is defined| -|sap_hana_deployment_sapcar_file_name|SAPCAR tool file name|Yes, unless `sap_hana_installdir` is defined| +|sap_hana_deployment_directories_permissions| Permissions for /hana/shared, /hana/data, /hana/log, and /usr/sap. | Yes| +|sap_hana_deployment_set_permissions| Set or verify permissions for /hana/shared, /hana/data, /hana/log, and /usr/sap. If set to `yes`, permissions will be set. If set to `no`, permissions will be verified and the role will abort if one of the permissions is not set correctly. | Yes. Default is `no`.| +|sap_hana_deployment_bundle_path_mn|Directory path on the managed node where the SAP HANA installation bundle SAR or ZIP file is located|yes, if `sap_hana_installdir` is not defined| +|sap_hana_deployment_bundle_file_name|File name of the SAP HANA installation bundle SAR or ZIP file|yes, if `sap_hana_installdir` is not defined| +|sap_hana_deployment_sapcar_file_name|File name of the SAPCAR executable|yes, if `sap_hana_installdir` is not defined and if the HANA installation bundle file type is "SAR"| +|sap_hana_deployment_sapcar_path_mn|Directory path of the SAPCAR executable on the managed node|yes, if `sap_hana_installdir` is not defined and if the HANA installation bundle file type is "SAR"| +|sap_hana_deployment_bundle_is_on_managed_node|Define if the SAP HANA installation bundle file is available on the managed node|yes, if `sap_hana_installdir` is not defined| +|sap_hana_deployment_bundle_is_on_control_node|Define if the SAP HANA installation bundle file is available on the control node|yes, if `sap_hana_installdir` is not defined| +|sap_hana_deployment_bundle_path_cn|Directory path on the control node where the SAP HANA installation bundle SAR or ZIP file is located|yes, if `sap_hana_installdir` is not defined and if sap_hana_deployment_bundle_is_on_control_node is set to `yes`| +|sap_hana_deployment_sapcar_path_cn|Directory path on the control node where the SAPCAR executable is located|yes, if `sap_hana_installdir` is not defined and if sap_hana_deployment_bundle_is_on_control_node is set to `yes` and if the HANA installation bundle file type is "SAR" | +|sap_hana_deployment_sap_software_remote_location|user, hostname, and directory to specify in which directory the SAP HANA installation bundle SAR or ZIP file is located on a third node|yes, if `sap_hana_installdir` is not defined and if sap_hana_deployment_bundle_is_on_managed_node is set to `no` and if sap_hana_deployment_bundle_is_on_control_node is set to `no`| +|sap_hana_installdir|Directory where hdblcm is located |No, if the location of a SAP HANA installation bundle file is specified using the above variables| |sap_hana_deployment_hdblcm_extraargs|Define extra commandline arguments to hdblcm, such as `--ignore=check1[,check2]` | No | |sap_hana_deployment_deploy_hostagent|Whatever you want to deploy SAP HostAgent or not|no, defaulted to `n` value| |sap_hana_deployment_use_master_password|Use single master password for all users, created during installation|no, defaulted to `n` value| diff --git a/defaults/main.yml b/defaults/main.yml index e377cbf..d3d0fba 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,26 +1,65 @@ # Global Default variables # Adapt to your default settings +# Directories and their permissions to set or verify +sap_hana_deployment_directories_permissions: + - { name: /hana/shared, value: '0755' } + - { name: /hana/data, value: '0755' } + - { name: /hana/log, value: '0755' } + - { name: /usr/sap, value: '0755' } + # If the following variable is set to 'yes', set permissions of -# /hana/shared, /hana/data, /hana/log, and /usr/sap to 0755. -# If the variable is set to 'no', verify the permissions. +# the directories in sap_hana_deployment_directories_permissions to the specified values. +# If the variable is set to 'no', verify these permissions. This is the default. sap_hana_deployment_set_permissions: no -# Target host path and file name for the bundle installation file -sap_hana_deployment_bundle_path: -sap_hana_deployment_bundle_sar_file_name: +# Directory of the SAP HANA bundle (.SAR or .ZIP) file on the managed node +# Example: /sap_download +sap_hana_deployment_bundle_path_mn: -# Target host path and file name for the zip installation file -sap_hana_deployment_zip_path: -sap_hana_deployment_zip_file_name: +# File name of the SAP HANA bundle (.SAR or .ZIP) file: +# Examples: SAP_HANA_DATABASE200_54_Linux_on_x86_64.SAR, 51055101.ZIP +sap_hana_deployment_bundle_file_name: -# Target host path and file name for the sapcar installation file -sap_hana_deployment_sapcar_path: +# File name of the SAPCAR executable (only needed in case of a SAP HANA bundle SAR file) +# Example: SAPCAR_1211-80000935.EXE sap_hana_deployment_sapcar_file_name: -# if the previous variables are undefined because you do not want to provide a bundle -# you can define sap_hana_installdir variable, which points to the directory containing hdblcm -# the role sap-hana-mediacheck can be used to define this variable +# Directory of the SAPCAR executable on the managed node (only needed in case of a SAP HANA bundle SAR file) +# Example: /usr/local/bin +sap_hana_deployment_sapcar_path_mn: + +# Are the SAP HANA bundle file (and sapcar) already on the managed node? +sap_hana_deployment_bundle_is_on_managed_node: no + +# Are the SAP HANA bundle file (and sapcar) on the control node? +sap_hana_deployment_bundle_is_on_control_node: no + +# Directory of the SAP HANA bundle (.SAR or .ZIP) file on the control node +# (only needed in case of sap_hana_deployment_bundle_is_on_control_node +# Example: /sap_download +sap_hana_deployment_bundle_path_cn: + +# Directory of the SAPCAR executable on the control node +# (only needed in case of a SAP HANA bundle SAR file and +# only in case of sap_hana_deployment_bundle_is_on_control_node) +# Example: /sap_download +sap_hana_deployment_sapcar_path_cn: + +# If the SAP HANA bundle file and sapcar are on another node, specify +# the login user, the host name, and the directory name to be used for the +# first argument to the scp command +# Example: root@host01:/sap_download +sap_hana_deployment_sap_software_remote_location: + +# Directory where to extract the SAP HANA bundle (.SAR or .ZIP) file on the managed node +# Example: /sap_extract +sap_hana_deployment_hana_extract_path: + +# If the previous variables are undefined because you do not want to provide a bundle, +# you can define sap_hana_installdir variable, which points to the directory containing hdblcm. +# The role sap-hana-mediacheck can be used to define this variable +# Example: /hana_install sap_hana_installdir: # Target host path and file name for the license file diff --git a/tasks/directories-permissions-assert-loop-block.yml b/tasks/directories-permissions-assert-loop-block.yml new file mode 100644 index 0000000..758e8ba --- /dev/null +++ b/tasks/directories-permissions-assert-loop-block.yml @@ -0,0 +1,14 @@ +--- + +# loop block for hana_deploy.yml + +- name: Get permissions of {{ line_item.name }} + stat: + path: "{{ line_item.name }}" + register: __sap_hana_deployment_register_stat + +- name: Assert that permissions of {{ line_item.name }} are '{{ line_item.value }}' + assert: + that: "__sap_hana_deployment_register_stat.stat.mode == '{{ line_item.value }}'" + fail_msg: "FAIL: Directory {{ line_item.name }} has permissions '{{ __sap_hana_deployment_register_stat.stat.mode }}' but needs to have '{{ line_item.value }}'!" + success_msg: "PASS: Directory {{ line_item.name }} has correct permissions '{{ __sap_hana_deployment_register_stat.stat.mode }}'." diff --git a/tasks/hana_deploy.yml b/tasks/hana_deploy.yml index e9772f4..e22b6c7 100644 --- a/tasks/hana_deploy.yml +++ b/tasks/hana_deploy.yml @@ -1,102 +1,111 @@ --- -- name: Set permissions of installation directories to 0755 +- name: Set permissions of installation directories file: - path: "{{ line_item }}" + path: "{{ line_item.name }}" state: directory - mode: 0755 - loop: - - /hana/shared - - /hana/data - - /hana/log - - /usr/sap + mode: "{{ line_item.value }}" + with_items: "{{ sap_hana_deployment_directories_permissions }}" loop_control: loop_var: line_item when: sap_hana_deployment_set_permissions - name: Assert correct permissions of installation directories + include_tasks: directories-permissions-assert-loop-block.yml + loop: "{{ sap_hana_deployment_directories_permissions }}" + loop_control: + loop_var: line_item + when: not sap_hana_deployment_set_permissions + +- name: Determine SAP HANA bundle file type + set_fact: + __sap_hana_preconfigure_fact_hana_bundle_file_type: '{{ sap_hana_deployment_bundle_file_name.split(".")[-1] }}' + +- name: Show SAP HANA bundle file type + debug: + var: __sap_hana_preconfigure_fact_hana_bundle_file_type + +- name: Copy the necessary SAP files from the control node block: - - name: Get permissions of /hana/shared - stat: - path: /hana/shared - register: __sap_hana_deployment_register_stat_hana_shared - - - name: Assert that permissions for /hana/shared are correct - assert: - that: __sap_hana_deployment_register_stat_hana_shared.stat.mode == '0755' - fail_msg: "FAIL: /hana/shared has permissions {{ __sap_hana_deployment_register_stat_hana_shared.stat.mode }} but needs to have '0755'!" - success_msg: "PASS: /hana/shared has correct permissions: {{ __sap_hana_deployment_register_stat_hana_shared.stat.mode }}." - - - name: Get permissions of /hana/data - stat: - path: /hana/shared - register: __sap_hana_deployment_register_stat_hana_data - - - name: Assert that permissions for /hana/data are correct - assert: - that: __sap_hana_deployment_register_stat_hana_data.stat.mode == '0755' - fail_msg: "FAIL: /hana/data has permissions {{ __sap_hana_deployment_register_stat_hana_data.stat.mode }} but needs to have '0755'!" - success_msg: "PASS: /hana/data has correct permissions: {{ __sap_hana_deployment_register_stat_hana_data.stat.mode }}." - - - name: Get permissions of /hana/log - stat: - path: /hana/log - register: __sap_hana_deployment_register_stat_hana_log - - - name: Assert that permissions for /hana/log are correct - assert: - that: __sap_hana_deployment_register_stat_hana_log.stat.mode == '0755' - fail_msg: "FAIL: /hana/log has permissions {{ __sap_hana_deployment_register_stat_hana_log.stat.mode }} but needs to have '0755'!" - success_msg: "PASS: /hana/log has correct permissions: {{ __sap_hana_deployment_register_stat_hana_log.stat.mode }}." - - - name: Get permissions of /usr/sap - stat: - path: /usr/sap - register: __sap_hana_deployment_register_stat_usr_sap - - - name: Assert that permissions for /usr/sap are correct - assert: - that: __sap_hana_deployment_register_stat_usr_sap.stat.mode == '0755' - fail_msg: "FAIL: /usr/sap has permissions {{ __sap_hana_deployment_register_stat_usr_sap.stat.mode }} but needs to have '0755'!" - success_msg: "PASS: /usr/sap has correct permissions: {{ __sap_hana_deployment_register_stat_usr_sap.stat.mode }}." + - name: Copy {{ sap_hana_deployment_bundle_file_name }} from {{ sap_hana_deployment_bundle_path_cn }} on the control node + copy: + src: "{{ sap_hana_deployment_bundle_path_cn }}/{{ sap_hana_deployment_bundle_file_name }}" + dest: "{{ sap_hana_deployment_bundle_path_mn }}/" + + - name: In case the SAP HANA bundle file is a SAR file, copy {{ sap_hana_deployment_sapcar_file_name }} from {{ sap_hana_deployment_sapcar_path_cn }} on the control node and set permissions to '0755' + copy: + src: "{{ sap_hana_deployment_sapcar_path_cn }}/{{ sap_hana_deployment_sapcar_file_name }}" + dest: "{{ sap_hana_deployment_sapcar_path_mn }}/" + mode: '0755' + when: __sap_hana_preconfigure_fact_hana_bundle_file_type == "SAR" + + when: + - sap_hana_deployment_bundle_is_on_control_node + - not sap_hana_deployment_bundle_is_on_managed_node + +- name: Copy the necessary SAP files from a third node + block: + - name: Get the remote user + set_fact: + __sap_hana_deployment_fact_remote_user: "{{ lookup('env', 'USER') }}" - when: not sap_hana_deployment_set_permissions + - name: Copy {{ sap_hana_deployment_bundle_file_name }} from {{ sap_hana_deployment_sap_software_remote_location }} + local_action: command scp -p {{ sap_hana_deployment_sap_software_remote_location }}/{{ sap_hana_deployment_bundle_file_name }} \ + {{ __sap_hana_deployment_fact_remote_user }}@{{ inventory_hostname }}:{{ sap_hana_deployment_bundle_path_mn }}/ + + - name: In case the SAP HANA bundle file is a SAR file, copy {{ sap_hana_deployment_sapcar_file_name }} from {{ sap_hana_deployment_sap_software_remote_location }} + local_action: command scp -p {{ sap_hana_deployment_sap_software_remote_location }}/{{ sap_hana_deployment_sapcar_file_name }} \ + {{ __sap_hana_deployment_fact_remote_user }}@{{ inventory_hostname }}:{{ sap_hana_deployment_sapcar_path_mn }}/ + when: __sap_hana_preconfigure_fact_hana_bundle_file_type == "SAR" + + - name: In case the SAP HANA bundle file is a SAR file, set the permission of {{ sap_hana_deployment_sapcar_file_name }} to '0755' + file: + path: "{{ sap_hana_deployment_sapcar_path_mn }}/{{ sap_hana_deployment_sapcar_file_name }}" + mode: '0755' + when: __sap_hana_preconfigure_fact_hana_bundle_file_type == "SAR" + + when: + - not sap_hana_deployment_bundle_is_on_control_node + - not sap_hana_deployment_bundle_is_on_managed_node -- name: Unpack SAPCAR archive (backwards compatibility) +- name: Extract the SAP HANA SAPCAR archive block: - - name: Use SAPCAR to extract the SAP HANA Bundle SAR file + - name: Use {{ sap_hana_deployment_sapcar_file_name }} to extract {{ sap_hana_deployment_bundle_file_name }} to directory {{ sap_hana_deployment_hana_extract_path }} command: >- - {{ sap_hana_deployment_sapcar_path }}/{{ sap_hana_deployment_sapcar_file_name }} \ - -xvf {{ sap_hana_deployment_bundle_path }}/{{ sap_hana_deployment_bundle_sar_file_name }} \ + {{ sap_hana_deployment_sapcar_path_mn }}/{{ sap_hana_deployment_sapcar_file_name }} + -xvf {{ sap_hana_deployment_bundle_path_mn }}/{{ sap_hana_deployment_bundle_file_name }} -manifest SIGNATURE.SMF register: sap_hana_deployment_register_extractbundle args: - chdir: "{{ sap_hana_deployment_sapcar_path }}" + chdir: "{{ sap_hana_deployment_hana_extract_path }}" changed_when: "'SAPCAR: processing archive' in sap_hana_deployment_register_extractbundle.stdout" - - name: Setting fact for HANA installer path + - name: Set fact for the SAP HANA installer path set_fact: - sap_hana_installdir: "{{ sap_hana_deployment_sapcar_path }}/SAP_HANA_DATABASE" + sap_hana_installdir: "{{ sap_hana_deployment_hana_extract_path }}/SAP_HANA_DATABASE" when: - - not(( sap_hana_deployment_bundle_path is none ) or ( sap_hana_deployment_bundle_path | trim == '')) - - not(( sap_hana_deployment_bundle_sar_file_name is none ) or (sap_hana_deployment_bundle_sar_file_name | trim == '')) + - not(( sap_hana_deployment_bundle_path_mn is none ) or ( sap_hana_deployment_bundle_path_mn | trim == '')) + - not(( sap_hana_deployment_bundle_file_name is none ) or (sap_hana_deployment_bundle_file_name | trim == '')) + - __sap_hana_preconfigure_fact_hana_bundle_file_type == "SAR" -- name: Extract ZIP archive +- name: Extract the SAP HANA ZIP archive block: - - name: Use unarchive to extract the SAP HANA Bundle ZIP file + - name: Unzip {{ sap_hana_deployment_bundle_file_name }} to directory {{ sap_hana_deployment_hana_extract_path }} unarchive: - src: "{{ sap_hana_deployment_zip_path }}/{{ sap_hana_deployment_zip_file_name }}" - dest: "{{ sap_hana_deployment_zip_path }}" + src: "{{ sap_hana_deployment_bundle_path_mn }}/{{ sap_hana_deployment_bundle_file_name }}" + dest: "{{ sap_hana_deployment_hana_extract_path }}" + remote_src: yes register: sap_hana_deployment_register_extractzip - - name: Setting fact for HANA installer path + - name: Set fact for the SAP HANA installer path set_fact: - sap_hana_installdir: "{{ sap_hana_deployment_zip_path }}/DATA_UNITS/HDB_SERVER_LINUX_X86_64" + sap_hana_installdir: "{{ sap_hana_deployment_hana_extract_path }}/DATA_UNITS/HDB_SERVER_LINUX_X86_64" when: - - not(( sap_hana_deployment_zip_path is none ) or ( sap_hana_deployment_zip_path | trim == '')) - - not(( sap_hana_deployment_zip_file_name is none ) or (sap_hana_deployment_zip_file_name | trim == '')) + - not(( sap_hana_deployment_bundle_path_mn is none ) or ( sap_hana_deployment_bundle_path_mn | trim == '')) + - not(( sap_hana_deployment_bundle_file_name is none ) or (sap_hana_deployment_bundle_file_name | trim == '')) + - __sap_hana_preconfigure_fact_hana_bundle_file_type == "ZIP" -- name: Check availability of "{{ sap_hana_installdir + '/hdblcm' }}" +- name: Check if file 'hdblcm' is in {{ sap_hana_installdir }} stat: path: "{{ sap_hana_installdir + '/hdblcm' }}" register: sap_hana_deployment_register_hdblcm_stat @@ -114,10 +123,10 @@ dest: "{{ tmpdir.path }}/configfile.cfg" register: cftemplate -- name: Copy file /tmp/tail-f-hdblcm-trc.sh +- name: Copy file tail-f-hdblcm-trc.sh to "{{ tmpdir.path }}" copy: src: tmp/tail-f-hdblcm-trc.sh - dest: /tmp/tail-f-hdblcm-trc.sh + dest: "{{ tmpdir.path }}/tail-f-hdblcm-trc.sh" owner: root group: root mode: '0755' @@ -125,9 +134,11 @@ - name: Show how to watch the installation process in real time debug: msg: - - 'Once the task "Install SAP HANA" has started, you can use the following command in - in another terminal to watch the installation progress in real time:' - - ssh {{ inventory_hostname }} /tmp/tail-f-hdblcm-trc.sh + - 'Once the task "Install SAP HANA" has started, you can use the following command + in a terminal session on the managed node to watch the installation progress in real time:' + - "{{ tmpdir.path }}/tail-f-hdblcm-trc.sh" + - 'Alternatively, you can run the following command on the control node:' + - "ssh {{ inventory_hostname }} {{ tmpdir.path }}/tail-f-hdblcm-trc.sh" - name: Install SAP HANA command: "./hdblcm {{ sap_hana_deployment_hdblcm_extraargs }} --configfile={{ tmpdir.path }}/configfile.cfg -b" From 85e825c105e74bf85a7520de54eff7def0c824e6 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Sun, 17 Oct 2021 01:21:17 +0200 Subject: [PATCH 06/23] fix lint and other errors --- ...ectories-permissions-assert-loop-block.yml | 3 +- tasks/hana_deploy.yml | 29 ++++++++++++------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/tasks/directories-permissions-assert-loop-block.yml b/tasks/directories-permissions-assert-loop-block.yml index 758e8ba..069699a 100644 --- a/tasks/directories-permissions-assert-loop-block.yml +++ b/tasks/directories-permissions-assert-loop-block.yml @@ -10,5 +10,6 @@ - name: Assert that permissions of {{ line_item.name }} are '{{ line_item.value }}' assert: that: "__sap_hana_deployment_register_stat.stat.mode == '{{ line_item.value }}'" - fail_msg: "FAIL: Directory {{ line_item.name }} has permissions '{{ __sap_hana_deployment_register_stat.stat.mode }}' but needs to have '{{ line_item.value }}'!" + fail_msg: "FAIL: Directory {{ line_item.name }} has permissions '{{ __sap_hana_deployment_register_stat.stat.mode }}' + but needs to have '{{ line_item.value }}'!" success_msg: "PASS: Directory {{ line_item.name }} has correct permissions '{{ __sap_hana_deployment_register_stat.stat.mode }}'." diff --git a/tasks/hana_deploy.yml b/tasks/hana_deploy.yml index e22b6c7..fa2771d 100644 --- a/tasks/hana_deploy.yml +++ b/tasks/hana_deploy.yml @@ -20,26 +20,28 @@ - name: Determine SAP HANA bundle file type set_fact: __sap_hana_preconfigure_fact_hana_bundle_file_type: '{{ sap_hana_deployment_bundle_file_name.split(".")[-1] }}' + when: (( sap_hana_installdir is none ) or ( sap_hana_installdir | trim == '')) - name: Show SAP HANA bundle file type debug: var: __sap_hana_preconfigure_fact_hana_bundle_file_type + when: (( sap_hana_installdir is none ) or ( sap_hana_installdir | trim == '')) - name: Copy the necessary SAP files from the control node block: - - name: Copy {{ sap_hana_deployment_bundle_file_name }} from {{ sap_hana_deployment_bundle_path_cn }} on the control node + - name: Copy the SAP HANA installation bundle file from the control node copy: src: "{{ sap_hana_deployment_bundle_path_cn }}/{{ sap_hana_deployment_bundle_file_name }}" dest: "{{ sap_hana_deployment_bundle_path_mn }}/" - - name: In case the SAP HANA bundle file is a SAR file, copy {{ sap_hana_deployment_sapcar_file_name }} from {{ sap_hana_deployment_sapcar_path_cn }} on the control node and set permissions to '0755' + - name: In case the SAP HANA bundle file is a SAR file, copy SAPCAR and set permissions to '0755' copy: src: "{{ sap_hana_deployment_sapcar_path_cn }}/{{ sap_hana_deployment_sapcar_file_name }}" dest: "{{ sap_hana_deployment_sapcar_path_mn }}/" mode: '0755' when: __sap_hana_preconfigure_fact_hana_bundle_file_type == "SAR" - when: + when: - sap_hana_deployment_bundle_is_on_control_node - not sap_hana_deployment_bundle_is_on_managed_node @@ -49,28 +51,31 @@ set_fact: __sap_hana_deployment_fact_remote_user: "{{ lookup('env', 'USER') }}" - - name: Copy {{ sap_hana_deployment_bundle_file_name }} from {{ sap_hana_deployment_sap_software_remote_location }} - local_action: command scp -p {{ sap_hana_deployment_sap_software_remote_location }}/{{ sap_hana_deployment_bundle_file_name }} \ + - name: Copy the SAP HANA installation bundle file from a third node + command: scp -p {{ sap_hana_deployment_sap_software_remote_location }}/{{ sap_hana_deployment_bundle_file_name }} \ {{ __sap_hana_deployment_fact_remote_user }}@{{ inventory_hostname }}:{{ sap_hana_deployment_bundle_path_mn }}/ + delegate_to: localhost - - name: In case the SAP HANA bundle file is a SAR file, copy {{ sap_hana_deployment_sapcar_file_name }} from {{ sap_hana_deployment_sap_software_remote_location }} - local_action: command scp -p {{ sap_hana_deployment_sap_software_remote_location }}/{{ sap_hana_deployment_sapcar_file_name }} \ + - name: In case the SAP HANA bundle file is a SAR file, copy SAPCAR + command: scp -p {{ sap_hana_deployment_sap_software_remote_location }}/{{ sap_hana_deployment_sapcar_file_name }} \ {{ __sap_hana_deployment_fact_remote_user }}@{{ inventory_hostname }}:{{ sap_hana_deployment_sapcar_path_mn }}/ + delegate_to: localhost when: __sap_hana_preconfigure_fact_hana_bundle_file_type == "SAR" - - name: In case the SAP HANA bundle file is a SAR file, set the permission of {{ sap_hana_deployment_sapcar_file_name }} to '0755' + - name: In case the SAP HANA bundle file is a SAR file, set the permission of SAPCAR to '0755' file: path: "{{ sap_hana_deployment_sapcar_path_mn }}/{{ sap_hana_deployment_sapcar_file_name }}" mode: '0755' when: __sap_hana_preconfigure_fact_hana_bundle_file_type == "SAR" - when: + when: - not sap_hana_deployment_bundle_is_on_control_node - not sap_hana_deployment_bundle_is_on_managed_node + - (( sap_hana_installdir is none ) or ( sap_hana_installdir | trim == '')) - name: Extract the SAP HANA SAPCAR archive block: - - name: Use {{ sap_hana_deployment_sapcar_file_name }} to extract {{ sap_hana_deployment_bundle_file_name }} to directory {{ sap_hana_deployment_hana_extract_path }} + - name: Use SAPCAR to extract the SAP HANA bundle file SAR FILE command: >- {{ sap_hana_deployment_sapcar_path_mn }}/{{ sap_hana_deployment_sapcar_file_name }} -xvf {{ sap_hana_deployment_bundle_path_mn }}/{{ sap_hana_deployment_bundle_file_name }} @@ -90,11 +95,12 @@ - name: Extract the SAP HANA ZIP archive block: - - name: Unzip {{ sap_hana_deployment_bundle_file_name }} to directory {{ sap_hana_deployment_hana_extract_path }} + - name: Unzip the SAP HANA bundle ZIP file unarchive: src: "{{ sap_hana_deployment_bundle_path_mn }}/{{ sap_hana_deployment_bundle_file_name }}" dest: "{{ sap_hana_deployment_hana_extract_path }}" remote_src: yes + mode: '0755' register: sap_hana_deployment_register_extractzip - name: Set fact for the SAP HANA installer path @@ -121,6 +127,7 @@ template: src: "{{ role_path }}/templates/configfile.j2" dest: "{{ tmpdir.path }}/configfile.cfg" + mode: '0644' register: cftemplate - name: Copy file tail-f-hdblcm-trc.sh to "{{ tmpdir.path }}" From d80b3d23bd4e1779a6eee2cdededd191a6bc194c Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Sun, 17 Oct 2021 01:50:09 +0200 Subject: [PATCH 07/23] solve issue #39 --- tasks/hana_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/hana_deploy.yml b/tasks/hana_deploy.yml index fa2771d..37ecd44 100644 --- a/tasks/hana_deploy.yml +++ b/tasks/hana_deploy.yml @@ -75,7 +75,7 @@ - name: Extract the SAP HANA SAPCAR archive block: - - name: Use SAPCAR to extract the SAP HANA bundle file SAR FILE + - name: Use SAPCAR to extract the SAP HANA bundle SAR file command: >- {{ sap_hana_deployment_sapcar_path_mn }}/{{ sap_hana_deployment_sapcar_file_name }} -xvf {{ sap_hana_deployment_bundle_path_mn }}/{{ sap_hana_deployment_bundle_file_name }} @@ -105,7 +105,7 @@ - name: Set fact for the SAP HANA installer path set_fact: - sap_hana_installdir: "{{ sap_hana_deployment_hana_extract_path }}/DATA_UNITS/HDB_SERVER_LINUX_X86_64" + sap_hana_installdir: "{{ sap_hana_deployment_hana_extract_path }}/DATA_UNITS/HDB_SERVER_LINUX_{{ ansible_architecture|upper }}" when: - not(( sap_hana_deployment_bundle_path_mn is none ) or ( sap_hana_deployment_bundle_path_mn | trim == '')) - not(( sap_hana_deployment_bundle_file_name is none ) or (sap_hana_deployment_bundle_file_name | trim == '')) From 9f0c88b6b12e5d7b412120bc6bfeb13497035565 Mon Sep 17 00:00:00 2001 From: Bernd Finger <> Date: Sun, 17 Oct 2021 21:35:45 +0200 Subject: [PATCH 08/23] Necessary adjustments to README.md --- README.md | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2530c48..f710ccc 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,14 @@ This role installs SAP HANA on a RHEL 7.x or 8.x system and applies a permament ## Requirements This role is intended to be used on a RHEL system on which SAP HANA software is to be installed. -So your system needs to be installed with at least the RHEL core packages, properly registered and prepared for HANA or Netweaver installation. +So your system needs to be installed with the RHEL package groups required for SAP HANA, properly registered, and prepared for HANA installation. It needs access to the software repositories required to install SAP HANA (see also: [How to subscribe SAP HANA systems to the Update Services for SAP Solutions](https://access.redhat.com/solutions/3075991)) -You can use the [redhat_sap.sap_rhsm](https://galaxy.ansible.com/redhat_sap/sap_rhsm) Galaxy Role to automate this process +You can use the [redhat_sap.sap_rhsm](https://galaxy.ansible.com/redhat_sap/sap_rhsm) Galaxy Role to automate this process. -To install SAP software on Red Hat Enterprise Linux you need some additional packages which come in a special repository. To get this repository you need to have one -of the following products: +To install SAP software on Red Hat Enterprise Linux you need some additional packages which come in a special repository. +To get this repository you need to have one of the following products: - [RHEL for SAP Solutions](https://access.redhat.com/solutions/3082481) (premium, standard, developer Edition) - [RHEL for Business Partner NFRs](https://partnercenter.redhat.com/NFRPageLayout) @@ -28,14 +28,41 @@ of the following products: product but only a special bundling. The subscription grants you access to the additional packages through our content delivery network(CDN) after installation. +For installing the required software and for configuring required system settings for SAP HANA, use the roles sap-preconfigure and +sap-hana-preconfigure from the RHEL System Roles for SAP package or the roles sap.rhel.preconfigure and sap.rhel.hana-preconfigure from +the sap.rhel collection on Red Hat Automation Hub or sap.linux.preconfigure and sap.linux.hana-preconfigure from the sap.linux collection +on Galaxy. + It is also important that your disks are setup according to the [SAP storage requirements for SAP HANA](https://www.sap.com/documents/2015/03/74cdb554-5a7c-0010-82c7-eda71af511fa.html). This [BLOG](https://blogs.sap.com/2017/03/07/the-ultimate-guide-to-effective-sizing-of-sap-hana/) is also quite helpful when sizing HANA systems. +## Actions performed by the role +### Get a valid user and group id to be used for the SAP HANA installation +In case no user and group ID is provided in variables sap_hana_deployment_hana_userid or sap_hana_deployment_hana_groupid, a user and group +ID is chosen according to certain rules. +### Install SAP HANA +#### Check or Set Permissions of relevant SAP directories +The role first checks of sets the permissions of SAP directories /hana/shared, /hana/data, /hana/log, and /usr/sap. The role variables +sap_hana_deployment_directories_permissions and sap_hana_deployment_set_permissions are used for this purpose. +#### Make the SAP HANA installation files available +The SAP HANA installation files have to be made available on the managed node before the installation can start. The role can: +- Use an existing HANA installation directory on the managed node +In this case, role variable sap_hana_installdir has to be set. +- Use a SAP HANA installation bundle file (SAR or ZIP) on the managed node, from the control node, or from a third node. +In this case, the following information has to be provided: +-- The location on the managed node to where the SAP HANA installation bundle file is to be extracted has to be specified + (role variable sap_hana_deployment_hana_extract_path). +-- The name and the existing or desired localtion of the SAP HANA installation bundle file (role variables sap_hana_deployment_bundle_file_name and sap_hana_deployment_bundle_path_mn). In case the installation bundle file is of type SAR, the file name of the SAPCAR executable and its exising or desired location on the managed node has to be specified as well (role variables sap_hana_deployment_sapcar_file_name and sap_hana_deployment_sapcar_path_mn). +-- Further information about where the SAP HANA installation bundle (and SAPCAR file, if applicable) are located on the control node or on a +third node, if necessary + ## Role Variables | variable | info | required? | |:--------:|:----------------------------:|:---------:| |sap_hana_deployment_directories_permissions| Permissions for /hana/shared, /hana/data, /hana/log, and /usr/sap. | Yes| |sap_hana_deployment_set_permissions| Set or verify permissions for /hana/shared, /hana/data, /hana/log, and /usr/sap. If set to `yes`, permissions will be set. If set to `no`, permissions will be verified and the role will abort if one of the permissions is not set correctly. | Yes. Default is `no`.| +|sap_hana_installdir|SAP HANA directory in which hdblcm is located |No, if the location of a SAP HANA installation bundle file is specified using one of the variables below| +|sap_hana_deployment_hana_extract_path|Directory path on the managed node to where the SAP HANA installation bundle SAR or ZIP file is to be extracted|yes, if `sap_hana_installdir` is not defined| |sap_hana_deployment_bundle_path_mn|Directory path on the managed node where the SAP HANA installation bundle SAR or ZIP file is located|yes, if `sap_hana_installdir` is not defined| |sap_hana_deployment_bundle_file_name|File name of the SAP HANA installation bundle SAR or ZIP file|yes, if `sap_hana_installdir` is not defined| |sap_hana_deployment_sapcar_file_name|File name of the SAPCAR executable|yes, if `sap_hana_installdir` is not defined and if the HANA installation bundle file type is "SAR"| @@ -45,7 +72,6 @@ It is also important that your disks are setup according to the [SAP storage req |sap_hana_deployment_bundle_path_cn|Directory path on the control node where the SAP HANA installation bundle SAR or ZIP file is located|yes, if `sap_hana_installdir` is not defined and if sap_hana_deployment_bundle_is_on_control_node is set to `yes`| |sap_hana_deployment_sapcar_path_cn|Directory path on the control node where the SAPCAR executable is located|yes, if `sap_hana_installdir` is not defined and if sap_hana_deployment_bundle_is_on_control_node is set to `yes` and if the HANA installation bundle file type is "SAR" | |sap_hana_deployment_sap_software_remote_location|user, hostname, and directory to specify in which directory the SAP HANA installation bundle SAR or ZIP file is located on a third node|yes, if `sap_hana_installdir` is not defined and if sap_hana_deployment_bundle_is_on_managed_node is set to `no` and if sap_hana_deployment_bundle_is_on_control_node is set to `no`| -|sap_hana_installdir|Directory where hdblcm is located |No, if the location of a SAP HANA installation bundle file is specified using the above variables| |sap_hana_deployment_hdblcm_extraargs|Define extra commandline arguments to hdblcm, such as `--ignore=check1[,check2]` | No | |sap_hana_deployment_deploy_hostagent|Whatever you want to deploy SAP HostAgent or not|no, defaulted to `n` value| |sap_hana_deployment_use_master_password|Use single master password for all users, created during installation|no, defaulted to `n` value| From 410330013611b93ed1c36ddb73bda173736db614 Mon Sep 17 00:00:00 2001 From: Bernd Finger <> Date: Sun, 17 Oct 2021 21:45:28 +0200 Subject: [PATCH 09/23] Further modifications to README.md --- README.md | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f710ccc..8c6cb07 100644 --- a/README.md +++ b/README.md @@ -40,20 +40,27 @@ It is also important that your disks are setup according to the [SAP storage req In case no user and group ID is provided in variables sap_hana_deployment_hana_userid or sap_hana_deployment_hana_groupid, a user and group ID is chosen according to certain rules. ### Install SAP HANA -#### Check or Set Permissions of relevant SAP directories +1. Check or Set Permissions of relevant SAP directories The role first checks of sets the permissions of SAP directories /hana/shared, /hana/data, /hana/log, and /usr/sap. The role variables sap_hana_deployment_directories_permissions and sap_hana_deployment_set_permissions are used for this purpose. -#### Make the SAP HANA installation files available +2. Make the SAP HANA installation files available The SAP HANA installation files have to be made available on the managed node before the installation can start. The role can: - Use an existing HANA installation directory on the managed node -In this case, role variable sap_hana_installdir has to be set. +In this case, role variable sap_hana_installdir has to be set to the directory in which the hdblcm program is located. - Use a SAP HANA installation bundle file (SAR or ZIP) on the managed node, from the control node, or from a third node. In this case, the following information has to be provided: --- The location on the managed node to where the SAP HANA installation bundle file is to be extracted has to be specified - (role variable sap_hana_deployment_hana_extract_path). --- The name and the existing or desired localtion of the SAP HANA installation bundle file (role variables sap_hana_deployment_bundle_file_name and sap_hana_deployment_bundle_path_mn). In case the installation bundle file is of type SAR, the file name of the SAPCAR executable and its exising or desired location on the managed node has to be specified as well (role variables sap_hana_deployment_sapcar_file_name and sap_hana_deployment_sapcar_path_mn). --- Further information about where the SAP HANA installation bundle (and SAPCAR file, if applicable) are located on the control node or on a -third node, if necessary + - The location on the managed node to where the SAP HANA installation bundle file is to be extracted (role variable + sap_hana_deployment_hana_extract_path). + - The name and the existing or desired localtion of the SAP HANA installation bundle file (role variables + sap_hana_deployment_bundle_file_name and sap_hana_deployment_bundle_path_mn). In case the installation bundle file is of type SAR, + the file name of the SAPCAR executable and its exising or desired location on the managed node has to be specified as well + (role variables sap_hana_deployment_sapcar_file_name and sap_hana_deployment_sapcar_path_mn). + - Further information about where the SAP HANA installation bundle (and SAPCAR file, if applicable) are located on the control node + or on a third node, if these files are available on the control node or on a third node. +3. Run the SAP HANA installation +Once the SAP HANA installation files are available on the managed node, the installation can be started. +4. Apply the SAP HANA license +After the SAP HANA installation has completed, the SAP HANA license can be applied. ## Role Variables From fa9f4c0d99100810e300eb5f1835d9c6b68cda14 Mon Sep 17 00:00:00 2001 From: Bernd Finger <> Date: Sun, 17 Oct 2021 21:48:22 +0200 Subject: [PATCH 10/23] some more... --- README.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8c6cb07..b136014 100644 --- a/README.md +++ b/README.md @@ -41,25 +41,36 @@ In case no user and group ID is provided in variables sap_hana_deployment_hana_u ID is chosen according to certain rules. ### Install SAP HANA 1. Check or Set Permissions of relevant SAP directories + The role first checks of sets the permissions of SAP directories /hana/shared, /hana/data, /hana/log, and /usr/sap. The role variables sap_hana_deployment_directories_permissions and sap_hana_deployment_set_permissions are used for this purpose. + 2. Make the SAP HANA installation files available + The SAP HANA installation files have to be made available on the managed node before the installation can start. The role can: -- Use an existing HANA installation directory on the managed node + + - Use an existing HANA installation directory on the managed node + In this case, role variable sap_hana_installdir has to be set to the directory in which the hdblcm program is located. -- Use a SAP HANA installation bundle file (SAR or ZIP) on the managed node, from the control node, or from a third node. + + - Use a SAP HANA installation bundle file (SAR or ZIP) on the managed node, from the control node, or from a third node. + In this case, the following information has to be provided: - - The location on the managed node to where the SAP HANA installation bundle file is to be extracted (role variable + - The location on the managed node to where the SAP HANA installation bundle file is to be extracted (role variable sap_hana_deployment_hana_extract_path). - - The name and the existing or desired localtion of the SAP HANA installation bundle file (role variables + - The name and the existing or desired localtion of the SAP HANA installation bundle file (role variables sap_hana_deployment_bundle_file_name and sap_hana_deployment_bundle_path_mn). In case the installation bundle file is of type SAR, the file name of the SAPCAR executable and its exising or desired location on the managed node has to be specified as well (role variables sap_hana_deployment_sapcar_file_name and sap_hana_deployment_sapcar_path_mn). - - Further information about where the SAP HANA installation bundle (and SAPCAR file, if applicable) are located on the control node + - Further information about where the SAP HANA installation bundle (and SAPCAR file, if applicable) are located on the control node or on a third node, if these files are available on the control node or on a third node. + 3. Run the SAP HANA installation + Once the SAP HANA installation files are available on the managed node, the installation can be started. + 4. Apply the SAP HANA license + After the SAP HANA installation has completed, the SAP HANA license can be applied. ## Role Variables From 6141470b641ae490b2a2c453ae4e9e504a7c9a38 Mon Sep 17 00:00:00 2001 From: Bernd Finger <> Date: Sun, 17 Oct 2021 21:48:58 +0200 Subject: [PATCH 11/23] some more... --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b136014..5b4fddd 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ In this case, role variable sap_hana_installdir has to be set to the directory i - Use a SAP HANA installation bundle file (SAR or ZIP) on the managed node, from the control node, or from a third node. In this case, the following information has to be provided: + - The location on the managed node to where the SAP HANA installation bundle file is to be extracted (role variable sap_hana_deployment_hana_extract_path). - The name and the existing or desired localtion of the SAP HANA installation bundle file (role variables From f5a6be27b192d7974e127203f3ba6c7e5c49c071 Mon Sep 17 00:00:00 2001 From: Bernd Finger <> Date: Sun, 17 Oct 2021 21:50:01 +0200 Subject: [PATCH 12/23] some more... --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5b4fddd..95faee1 100644 --- a/README.md +++ b/README.md @@ -42,37 +42,39 @@ ID is chosen according to certain rules. ### Install SAP HANA 1. Check or Set Permissions of relevant SAP directories -The role first checks of sets the permissions of SAP directories /hana/shared, /hana/data, /hana/log, and /usr/sap. The role variables -sap_hana_deployment_directories_permissions and sap_hana_deployment_set_permissions are used for this purpose. + The role first checks of sets the permissions of SAP directories /hana/shared, /hana/data, /hana/log, and /usr/sap. The role variables + sap_hana_deployment_directories_permissions and sap_hana_deployment_set_permissions are used for this purpose. 2. Make the SAP HANA installation files available -The SAP HANA installation files have to be made available on the managed node before the installation can start. The role can: + The SAP HANA installation files have to be made available on the managed node before the installation can start. The role can: - Use an existing HANA installation directory on the managed node -In this case, role variable sap_hana_installdir has to be set to the directory in which the hdblcm program is located. + In this case, role variable sap_hana_installdir has to be set to the directory in which the hdblcm program is located. - Use a SAP HANA installation bundle file (SAR or ZIP) on the managed node, from the control node, or from a third node. -In this case, the following information has to be provided: + In this case, the following information has to be provided: - The location on the managed node to where the SAP HANA installation bundle file is to be extracted (role variable sap_hana_deployment_hana_extract_path). + - The name and the existing or desired localtion of the SAP HANA installation bundle file (role variables sap_hana_deployment_bundle_file_name and sap_hana_deployment_bundle_path_mn). In case the installation bundle file is of type SAR, the file name of the SAPCAR executable and its exising or desired location on the managed node has to be specified as well (role variables sap_hana_deployment_sapcar_file_name and sap_hana_deployment_sapcar_path_mn). + - Further information about where the SAP HANA installation bundle (and SAPCAR file, if applicable) are located on the control node or on a third node, if these files are available on the control node or on a third node. 3. Run the SAP HANA installation -Once the SAP HANA installation files are available on the managed node, the installation can be started. + Once the SAP HANA installation files are available on the managed node, the installation can be started. 4. Apply the SAP HANA license -After the SAP HANA installation has completed, the SAP HANA license can be applied. + After the SAP HANA installation has completed, the SAP HANA license can be applied. ## Role Variables From 1d499da3c1e8b3eceb2afcf6d32461e58cbcc291 Mon Sep 17 00:00:00 2001 From: Bernd Finger <> Date: Sun, 17 Oct 2021 21:53:05 +0200 Subject: [PATCH 13/23] some more... --- README.md | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 95faee1..fdfda8f 100644 --- a/README.md +++ b/README.md @@ -37,43 +37,39 @@ It is also important that your disks are setup according to the [SAP storage req ## Actions performed by the role ### Get a valid user and group id to be used for the SAP HANA installation -In case no user and group ID is provided in variables sap_hana_deployment_hana_userid or sap_hana_deployment_hana_groupid, a user and group -ID is chosen according to certain rules. +In case no user and group ID is provided by using variables sap_hana_deployment_hana_userid or sap_hana_deployment_hana_groupid, +a user and group ID is chosen according to certain rules. ### Install SAP HANA -1. Check or Set Permissions of relevant SAP directories - +#### Check or Set Permissions of relevant SAP directories The role first checks of sets the permissions of SAP directories /hana/shared, /hana/data, /hana/log, and /usr/sap. The role variables sap_hana_deployment_directories_permissions and sap_hana_deployment_set_permissions are used for this purpose. -2. Make the SAP HANA installation files available - +#### Make the SAP HANA installation files available The SAP HANA installation files have to be made available on the managed node before the installation can start. The role can: - Use an existing HANA installation directory on the managed node - In this case, role variable sap_hana_installdir has to be set to the directory in which the hdblcm program is located. + In this case, role variable sap_hana_installdir has to be set to the directory in which the hdblcm program is located. - Use a SAP HANA installation bundle file (SAR or ZIP) on the managed node, from the control node, or from a third node. - In this case, the following information has to be provided: + In this case, the following information has to be provided: - The location on the managed node to where the SAP HANA installation bundle file is to be extracted (role variable - sap_hana_deployment_hana_extract_path). + sap_hana_deployment_hana_extract_path). - The name and the existing or desired localtion of the SAP HANA installation bundle file (role variables - sap_hana_deployment_bundle_file_name and sap_hana_deployment_bundle_path_mn). In case the installation bundle file is of type SAR, - the file name of the SAPCAR executable and its exising or desired location on the managed node has to be specified as well - (role variables sap_hana_deployment_sapcar_file_name and sap_hana_deployment_sapcar_path_mn). + sap_hana_deployment_bundle_file_name and sap_hana_deployment_bundle_path_mn). In case the installation bundle file is of type SAR, + the file name of the SAPCAR executable and its exising or desired location on the managed node has to be specified as well + (role variables sap_hana_deployment_sapcar_file_name and sap_hana_deployment_sapcar_path_mn). - Further information about where the SAP HANA installation bundle (and SAPCAR file, if applicable) are located on the control node - or on a third node, if these files are available on the control node or on a third node. - -3. Run the SAP HANA installation + or on a third node, if these files are available on the control node or on a third node. +#### Run the SAP HANA installation Once the SAP HANA installation files are available on the managed node, the installation can be started. -4. Apply the SAP HANA license - +#### Apply the SAP HANA license After the SAP HANA installation has completed, the SAP HANA license can be applied. ## Role Variables From 97af93dd678017a83d18126643b5308bad096a14 Mon Sep 17 00:00:00 2001 From: Bernd Finger <> Date: Sun, 17 Oct 2021 21:54:43 +0200 Subject: [PATCH 14/23] some more... --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fdfda8f..ddb26c6 100644 --- a/README.md +++ b/README.md @@ -40,11 +40,11 @@ It is also important that your disks are setup according to the [SAP storage req In case no user and group ID is provided by using variables sap_hana_deployment_hana_userid or sap_hana_deployment_hana_groupid, a user and group ID is chosen according to certain rules. ### Install SAP HANA -#### Check or Set Permissions of relevant SAP directories +#### 1\. Check or Set Permissions of relevant SAP directories The role first checks of sets the permissions of SAP directories /hana/shared, /hana/data, /hana/log, and /usr/sap. The role variables sap_hana_deployment_directories_permissions and sap_hana_deployment_set_permissions are used for this purpose. -#### Make the SAP HANA installation files available +#### 2\. Make the SAP HANA installation files available The SAP HANA installation files have to be made available on the managed node before the installation can start. The role can: - Use an existing HANA installation directory on the managed node @@ -66,10 +66,10 @@ a user and group ID is chosen according to certain rules. - Further information about where the SAP HANA installation bundle (and SAPCAR file, if applicable) are located on the control node or on a third node, if these files are available on the control node or on a third node. -#### Run the SAP HANA installation +#### 3\. Run the SAP HANA installation Once the SAP HANA installation files are available on the managed node, the installation can be started. -#### Apply the SAP HANA license +#### 4\. Apply the SAP HANA license After the SAP HANA installation has completed, the SAP HANA license can be applied. ## Role Variables From 2ed807c6a780b94c610d6be5a913050d41918637 Mon Sep 17 00:00:00 2001 From: Bernd Finger <> Date: Mon, 18 Oct 2021 09:29:35 +0200 Subject: [PATCH 15/23] Restructure task files --- tasks/{license.yml => apply_hana_license.yml} | 0 tasks/install_hana.yml | 44 ++++++++++++++ tasks/main.yml | 12 ++-- ...l => provide_hana_installation_bundle.yml} | 60 ------------------- tasks/set_or_verify_permissions.yml | 18 ++++++ 5 files changed, 70 insertions(+), 64 deletions(-) rename tasks/{license.yml => apply_hana_license.yml} (100%) create mode 100644 tasks/install_hana.yml rename tasks/{hana_deploy.yml => provide_hana_installation_bundle.yml} (68%) create mode 100644 tasks/set_or_verify_permissions.yml diff --git a/tasks/license.yml b/tasks/apply_hana_license.yml similarity index 100% rename from tasks/license.yml rename to tasks/apply_hana_license.yml diff --git a/tasks/install_hana.yml b/tasks/install_hana.yml new file mode 100644 index 0000000..c22d472 --- /dev/null +++ b/tasks/install_hana.yml @@ -0,0 +1,44 @@ +--- + +- name: Check if file 'hdblcm' is in {{ sap_hana_installdir }} + stat: + path: "{{ sap_hana_installdir + '/hdblcm' }}" + register: sap_hana_deployment_register_hdblcm_stat + failed_when: not sap_hana_deployment_register_hdblcm_stat.stat.exists + +- name: Create temporary directory to store the processed template + tempfile: + state: directory + suffix: hanaconfig + register: tmpdir + +- name: "Process HANA Configfile Template" + template: + src: "{{ role_path }}/templates/configfile.j2" + dest: "{{ tmpdir.path }}/configfile.cfg" + mode: '0644' + register: cftemplate + +- name: Copy file tail-f-hdblcm-trc.sh to "{{ tmpdir.path }}" + copy: + src: tmp/tail-f-hdblcm-trc.sh + dest: "{{ tmpdir.path }}/tail-f-hdblcm-trc.sh" + owner: root + group: root + mode: '0755' + +- name: Show how to watch the installation process in real time + debug: + msg: + - 'Once the task "Install SAP HANA" has started, you can use the following command' + - 'in a terminal session on the managed node to watch the installation progress in real time:' + - "{{ tmpdir.path }}/tail-f-hdblcm-trc.sh" + - 'Alternatively, you can run the following command on the control node:' + - "ssh {{ inventory_hostname }} {{ tmpdir.path }}/tail-f-hdblcm-trc.sh" + +- name: Install SAP HANA + command: "./hdblcm {{ sap_hana_deployment_hdblcm_extraargs }} --configfile={{ tmpdir.path }}/configfile.cfg -b" + register: installhana + args: + chdir: "{{ sap_hana_installdir }}" + changed_when: "'SAP HANA Lifecycle Management' in installhana.stdout" diff --git a/tasks/main.yml b/tasks/main.yml index b2839c4..4a96c6a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -13,8 +13,12 @@ - import_tasks: password_facts.yml when: sap_hana_deployment_use_master_password == 'y' -- import_tasks: hana_deploy.yml - when: not sap_hana_deployment_apply_license +- import_tasks: set_or_verify_permissions.yml -- import_tasks: license.yml - when: sap_hana_deployment_apply_license \ No newline at end of file +- import_tasks: provide_hana_installation_bundle.yml + when: (( sap_hana_installdir is none ) or ( sap_hana_installdir | trim == '')) + +- import_tasks: install_hana.yml + +- import_tasks: apply_hana_license.yml + when: sap_hana_deployment_apply_license diff --git a/tasks/hana_deploy.yml b/tasks/provide_hana_installation_bundle.yml similarity index 68% rename from tasks/hana_deploy.yml rename to tasks/provide_hana_installation_bundle.yml index 37ecd44..72c109b 100644 --- a/tasks/hana_deploy.yml +++ b/tasks/provide_hana_installation_bundle.yml @@ -1,22 +1,5 @@ --- -- name: Set permissions of installation directories - file: - path: "{{ line_item.name }}" - state: directory - mode: "{{ line_item.value }}" - with_items: "{{ sap_hana_deployment_directories_permissions }}" - loop_control: - loop_var: line_item - when: sap_hana_deployment_set_permissions - -- name: Assert correct permissions of installation directories - include_tasks: directories-permissions-assert-loop-block.yml - loop: "{{ sap_hana_deployment_directories_permissions }}" - loop_control: - loop_var: line_item - when: not sap_hana_deployment_set_permissions - - name: Determine SAP HANA bundle file type set_fact: __sap_hana_preconfigure_fact_hana_bundle_file_type: '{{ sap_hana_deployment_bundle_file_name.split(".")[-1] }}' @@ -110,46 +93,3 @@ - not(( sap_hana_deployment_bundle_path_mn is none ) or ( sap_hana_deployment_bundle_path_mn | trim == '')) - not(( sap_hana_deployment_bundle_file_name is none ) or (sap_hana_deployment_bundle_file_name | trim == '')) - __sap_hana_preconfigure_fact_hana_bundle_file_type == "ZIP" - -- name: Check if file 'hdblcm' is in {{ sap_hana_installdir }} - stat: - path: "{{ sap_hana_installdir + '/hdblcm' }}" - register: sap_hana_deployment_register_hdblcm_stat - failed_when: not sap_hana_deployment_register_hdblcm_stat.stat.exists - -- name: Create temporary directory to store the processed template - tempfile: - state: directory - suffix: hanaconfig - register: tmpdir - -- name: "Process HANA Configfile Template" - template: - src: "{{ role_path }}/templates/configfile.j2" - dest: "{{ tmpdir.path }}/configfile.cfg" - mode: '0644' - register: cftemplate - -- name: Copy file tail-f-hdblcm-trc.sh to "{{ tmpdir.path }}" - copy: - src: tmp/tail-f-hdblcm-trc.sh - dest: "{{ tmpdir.path }}/tail-f-hdblcm-trc.sh" - owner: root - group: root - mode: '0755' - -- name: Show how to watch the installation process in real time - debug: - msg: - - 'Once the task "Install SAP HANA" has started, you can use the following command - in a terminal session on the managed node to watch the installation progress in real time:' - - "{{ tmpdir.path }}/tail-f-hdblcm-trc.sh" - - 'Alternatively, you can run the following command on the control node:' - - "ssh {{ inventory_hostname }} {{ tmpdir.path }}/tail-f-hdblcm-trc.sh" - -- name: Install SAP HANA - command: "./hdblcm {{ sap_hana_deployment_hdblcm_extraargs }} --configfile={{ tmpdir.path }}/configfile.cfg -b" - register: installhana - args: - chdir: "{{ sap_hana_installdir }}" - changed_when: "'SAP HANA Lifecycle Management' in installhana.stdout" diff --git a/tasks/set_or_verify_permissions.yml b/tasks/set_or_verify_permissions.yml new file mode 100644 index 0000000..b572251 --- /dev/null +++ b/tasks/set_or_verify_permissions.yml @@ -0,0 +1,18 @@ +--- + +- name: Set permissions of installation directories + file: + path: "{{ line_item.name }}" + state: directory + mode: "{{ line_item.value }}" + with_items: "{{ sap_hana_deployment_directories_permissions }}" + loop_control: + loop_var: line_item + when: sap_hana_deployment_set_permissions + +- name: Assert correct permissions of installation directories + include_tasks: directories-permissions-assert-loop-block.yml + loop: "{{ sap_hana_deployment_directories_permissions }}" + loop_control: + loop_var: line_item + when: not sap_hana_deployment_set_permissions From 3857d71a9a972507b889c109e8c518d40111a240 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 18 Oct 2021 14:33:49 +0200 Subject: [PATCH 16/23] Solve issue #40; some minor changes --- README.md | 24 ++++++++----------- defaults/main.yml | 17 +++++++------ tasks/apply_hana_license.yml | 4 ++-- tasks/install_hana.yml | 2 +- tasks/main.yml | 12 ++++++---- tasks/provide_hana_installation_bundle.yml | 28 +++++++++++----------- 6 files changed, 45 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index ddb26c6..03f4420 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ a user and group ID is chosen according to certain rules. |sap_hana_deployment_directories_permissions| Permissions for /hana/shared, /hana/data, /hana/log, and /usr/sap. | Yes| |sap_hana_deployment_set_permissions| Set or verify permissions for /hana/shared, /hana/data, /hana/log, and /usr/sap. If set to `yes`, permissions will be set. If set to `no`, permissions will be verified and the role will abort if one of the permissions is not set correctly. | Yes. Default is `no`.| |sap_hana_installdir|SAP HANA directory in which hdblcm is located |No, if the location of a SAP HANA installation bundle file is specified using one of the variables below| -|sap_hana_deployment_hana_extract_path|Directory path on the managed node to where the SAP HANA installation bundle SAR or ZIP file is to be extracted|yes, if `sap_hana_installdir` is not defined| +|sap_hana_deployment_hana_extraction_path|Directory path on the managed node to where the SAP HANA installation bundle SAR or ZIP file is to be extracted|yes, if `sap_hana_installdir` is not defined| |sap_hana_deployment_bundle_path_mn|Directory path on the managed node where the SAP HANA installation bundle SAR or ZIP file is located|yes, if `sap_hana_installdir` is not defined| |sap_hana_deployment_bundle_file_name|File name of the SAP HANA installation bundle SAR or ZIP file|yes, if `sap_hana_installdir` is not defined| |sap_hana_deployment_sapcar_file_name|File name of the SAPCAR executable|yes, if `sap_hana_installdir` is not defined and if the HANA installation bundle file type is "SAR"| @@ -126,25 +126,21 @@ a user and group ID is chosen according to certain rules. |sap_hana_deployment_xs_components_nostart|Do not start the selected XS Advanced components after installation|Only if `sap_hana_deployment_xs_install` is `y`, defaulted to `none`| |sap_hana_deployment_lss_user|Local Secure Store User ID|no| |sap_hana_deployment_lss_group|Local Secure Store User Group ID|no| -|sap_hana_deployment_apply_license|Whether to apply a License File to the deployed HANA instance|no, defaulted to 'false'| -|sap_hana_deployment_license_path|Target host directory path where HANA license file located|no, required if `sap_hana_deployment_apply_license` true| -|sap_hana_deployment_license_file_name|HANA license file name|no, required if `sap_hana_deployment_apply_license` true| +|sap_hana_deployment_apply_license_only|Whether to apply a license file only|no, defaulted to 'false'| +|sap_hana_deployment_apply_license|Whether to apply a license file after the SAP HANA installation|no, defaulted to 'false'| +|sap_hana_deployment_license_path|directory path on the managed node where the HANA DB license file located|no, required only if `sap_hana_deployment_apply_license` true| +|sap_hana_deployment_license_file_name|HANA DB license file name|no, required only if `sap_hana_deployment_apply_license` true| -## HANA Deploy and HANA Lincese +## HANA Deployment and HANA License -While using this role 2 different scenarios can be covered. These are SAP HANA deployment in a new RHEL Server and set the HANA DB License in an existing deployment. - -In order the role to run the first scenario, SAP HANA deployment in a new RHEL Server, the variable `sap_hana_deployment_apply_license` must be `false`. - -In order the role to run the second scenario, set the HANA DB License in an existing deployment, the variable `sap_hana_deployment_apply_license` must be `true`. - -Variables required for both scenarios are the ones specified already. +The role supports two different scenarios: SAP HANA deployment in a RHEL system, with or without applying a SAP HANA DB license, +and applying a SAP HANA DB license in an existing deployment only. ## Dependencies -Before using this role ensure your system has been configured properly to run SAP applications and HANA. +Before using this role, ensure that your system has been configured properly to run SAP applications and SAP HANA. -You can use the supported roles `sap-preconfigure` and `sap-hana-preconfigure` comming with RHEL 7 and 8 with RHEL for SAP Solutions Subscription +You can use the supported roles `sap-preconfigure` and `sap-hana-preconfigure` on RHEL 8 control nodes, which are part of the RHEL for SAP Solutions Subscription. The upstream version of these role can be found [here](https://github.com/linux-system-roles/sap-preconfigure) and [here](https://github.com/linux-system-roles/sap-hana-preconfigure) diff --git a/defaults/main.yml b/defaults/main.yml index d3d0fba..0c8a6bf 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -13,6 +13,12 @@ sap_hana_deployment_directories_permissions: # If the variable is set to 'no', verify these permissions. This is the default. sap_hana_deployment_set_permissions: no +# If the HANA installation files have already been extracted on the managed node, specify +# the name of the directory which contains hdblcm here. +# The role sap-hana-mediacheck can be used to define this variable +# Example: /hana_install +sap_hana_installdir: + # Directory of the SAP HANA bundle (.SAR or .ZIP) file on the managed node # Example: /sap_download sap_hana_deployment_bundle_path_mn: @@ -36,7 +42,7 @@ sap_hana_deployment_bundle_is_on_managed_node: no sap_hana_deployment_bundle_is_on_control_node: no # Directory of the SAP HANA bundle (.SAR or .ZIP) file on the control node -# (only needed in case of sap_hana_deployment_bundle_is_on_control_node +# (only needed in case of sap_hana_deployment_bundle_is_on_control_node) # Example: /sap_download sap_hana_deployment_bundle_path_cn: @@ -54,13 +60,10 @@ sap_hana_deployment_sap_software_remote_location: # Directory where to extract the SAP HANA bundle (.SAR or .ZIP) file on the managed node # Example: /sap_extract -sap_hana_deployment_hana_extract_path: +sap_hana_deployment_hana_extraction_path: -# If the previous variables are undefined because you do not want to provide a bundle, -# you can define sap_hana_installdir variable, which points to the directory containing hdblcm. -# The role sap-hana-mediacheck can be used to define this variable -# Example: /hana_install -sap_hana_installdir: +# Apply a SAP HANA DB license only? Default is no. +sap_hana_deployment_apply_license_only: no # Target host path and file name for the license file sap_hana_deployment_license_path: diff --git a/tasks/apply_hana_license.yml b/tasks/apply_hana_license.yml index 37ddd26..e51b7b3 100644 --- a/tasks/apply_hana_license.yml +++ b/tasks/apply_hana_license.yml @@ -1,13 +1,13 @@ --- -- name: Apply HANA license to the new deployed instance +- name: Apply HANA DB license to the newly deployed instance shell: | /usr/sap/{{ sap_hana_deployment_hana_sid | upper }}/HDB{{ sap_hana_deployment_hana_instance_number }}/exe/hdbsql \ -i {{ sap_hana_deployment_hana_instance_number }} -u SYSTEM -p {{ sap_hana_deployment_hana_db_system_password }} -m <- {{ sap_hana_deployment_sapcar_path_mn }}/{{ sap_hana_deployment_sapcar_file_name }} -xvf {{ sap_hana_deployment_bundle_path_mn }}/{{ sap_hana_deployment_bundle_file_name }} -manifest SIGNATURE.SMF register: sap_hana_deployment_register_extractbundle args: - chdir: "{{ sap_hana_deployment_hana_extract_path }}" + chdir: "{{ sap_hana_deployment_hana_extraction_path }}" changed_when: "'SAPCAR: processing archive' in sap_hana_deployment_register_extractbundle.stdout" - - name: Set fact for the SAP HANA installer path + - name: "SAR file: Set fact for the SAP HANA installer path" set_fact: - sap_hana_installdir: "{{ sap_hana_deployment_hana_extract_path }}/SAP_HANA_DATABASE" + sap_hana_installdir: "{{ sap_hana_deployment_hana_extraction_path }}/SAP_HANA_DATABASE" when: - not(( sap_hana_deployment_bundle_path_mn is none ) or ( sap_hana_deployment_bundle_path_mn | trim == '')) - not(( sap_hana_deployment_bundle_file_name is none ) or (sap_hana_deployment_bundle_file_name | trim == '')) @@ -78,17 +78,17 @@ - name: Extract the SAP HANA ZIP archive block: - - name: Unzip the SAP HANA bundle ZIP file + - name: "Unzip the SAP HANA installation bundle ZIP file" unarchive: src: "{{ sap_hana_deployment_bundle_path_mn }}/{{ sap_hana_deployment_bundle_file_name }}" - dest: "{{ sap_hana_deployment_hana_extract_path }}" + dest: "{{ sap_hana_deployment_hana_extraction_path }}" remote_src: yes mode: '0755' register: sap_hana_deployment_register_extractzip - - name: Set fact for the SAP HANA installer path + - name: "ZIP file: Set fact for the SAP HANA installer path" set_fact: - sap_hana_installdir: "{{ sap_hana_deployment_hana_extract_path }}/DATA_UNITS/HDB_SERVER_LINUX_{{ ansible_architecture|upper }}" + sap_hana_installdir: "{{ sap_hana_deployment_hana_extraction_path }}/DATA_UNITS/HDB_SERVER_LINUX_{{ ansible_architecture|upper }}" when: - not(( sap_hana_deployment_bundle_path_mn is none ) or ( sap_hana_deployment_bundle_path_mn | trim == '')) - not(( sap_hana_deployment_bundle_file_name is none ) or (sap_hana_deployment_bundle_file_name | trim == '')) From 6fcca9081ef5abd5a2f58f3ca66890c4b5f77ca6 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 18 Oct 2021 14:57:26 +0200 Subject: [PATCH 17/23] Solve remaining lint issues --- tasks/main.yml | 2 +- tasks/provide_hana_installation_bundle.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 56b3f45..8c3ebc8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -17,7 +17,7 @@ when: not sap_hana_deployment_apply_license_only - import_tasks: provide_hana_installation_bundle.yml - when: + when: - (( sap_hana_installdir is none ) or ( sap_hana_installdir | trim == '')) - not sap_hana_deployment_apply_license_only diff --git a/tasks/provide_hana_installation_bundle.yml b/tasks/provide_hana_installation_bundle.yml index d9dbbcb..8e7f822 100644 --- a/tasks/provide_hana_installation_bundle.yml +++ b/tasks/provide_hana_installation_bundle.yml @@ -16,6 +16,7 @@ copy: src: "{{ sap_hana_deployment_bundle_path_cn }}/{{ sap_hana_deployment_bundle_file_name }}" dest: "{{ sap_hana_deployment_bundle_path_mn }}/" + mode: '0644' - name: "cn: If the SAP HANA installation bundle file is a SAR file, copy SAPCAR and set permissions to '0755'" copy: From c5ec9616544f42009d4547feac40693502844e74 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 18 Oct 2021 21:07:58 +0200 Subject: [PATCH 18/23] Solve issue #41: Support HANA scale-out installation --- README.md | 5 ++++- defaults/main.yml | 1 + templates/configfile.j2 | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 03f4420..bcdaa8c 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,9 @@ a user and group ID is chosen according to certain rules. or on a third node, if these files are available on the control node or on a third node. #### 3\. Run the SAP HANA installation - Once the SAP HANA installation files are available on the managed node, the installation can be started. + Once the SAP HANA installation files are available on the managed node, the installation on the is started on the managed node. + By specifying a valid argument to variable sap_hana_deployment_addhosts, a SAP HANA scale-out installation is performed on the + additional hosts. #### 4\. Apply the SAP HANA license After the SAP HANA installation has completed, the SAP HANA license can be applied. @@ -113,6 +115,7 @@ a user and group ID is chosen according to certain rules. |sap_hana_deployment_system_restart|Restart system after machine reboot|no, defaulted to `n`| |sap_hana_deployment_create_initial_tenant|Create an initial tenant with the SAP HANA installation|yes, defaulted to `y`| |sap_hana_deployment_hostname|Hostname for the installation (e.g.if a virtual name is to be used)|yes, defaulted to the physical hostname| +|sap_hana_deployment_addhosts|a valid 'hostname:role=...,hostname:role=...' string as per SAP HANA Server Installation and Updated Guide. Example: 'host02:role=worker:workergroup=wg01:group=g01,host03:role=worker'|Only for HANA scale-out installation| |sap_hana_deployment_xs_install|Install XS Advanced in the default tenant database|no, defaulted to `n`| |sap_hana_deployment_xs_path|XS Advanced App Working Path|Only if `sap_hana_deployment_xs_install` is `y`| |sap_hana_deployment_xs_orgname|Organization Name For Space "SAP"|Only if `sap_hana_deployment_xs_install` is `y`, defaulted to `orgname`| diff --git a/defaults/main.yml b/defaults/main.yml index 0c8a6bf..963d1e7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -95,6 +95,7 @@ sap_hana_deployment_hana_db_system_password: sap_hana_deployment_system_restart: 'n' sap_hana_deployment_create_initial_tenant: sap_hana_deployment_hostname: +sap_hana_deployment_addhosts: sap_hana_deployment_xs_install: 'n' sap_hana_deployment_xs_path: sap_hana_deployment_xs_orgname: 'orgname' diff --git a/templates/configfile.j2 b/templates/configfile.j2 index 46add37..6e767e7 100644 --- a/templates/configfile.j2 +++ b/templates/configfile.j2 @@ -151,7 +151,7 @@ isc_mode= auto_initialize_services=y # Additional Hosts -addhosts= +addhosts={{ sap_hana_deployment_addhosts }} # Additional Local Host Roles ( Valid values: extended_storage_worker | extended_storage_standby | ets_worker | ets_standby | streaming | xs_worker | xs_standby ) add_local_roles= From 8624e0aab4cf3467355fa1efdef8842c18528230 Mon Sep 17 00:00:00 2001 From: Bernd Finger <> Date: Wed, 20 Oct 2021 17:54:28 +0200 Subject: [PATCH 19/23] adapt the example in README.md; create SAP extract directory before extracting; support zip and ZIP --- README.md | 25 ++++++++++++---------- tasks/provide_hana_installation_bundle.yml | 16 ++++++++++++-- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index bcdaa8c..a583a1b 100644 --- a/README.md +++ b/README.md @@ -82,11 +82,11 @@ a user and group ID is chosen according to certain rules. |sap_hana_deployment_set_permissions| Set or verify permissions for /hana/shared, /hana/data, /hana/log, and /usr/sap. If set to `yes`, permissions will be set. If set to `no`, permissions will be verified and the role will abort if one of the permissions is not set correctly. | Yes. Default is `no`.| |sap_hana_installdir|SAP HANA directory in which hdblcm is located |No, if the location of a SAP HANA installation bundle file is specified using one of the variables below| |sap_hana_deployment_hana_extraction_path|Directory path on the managed node to where the SAP HANA installation bundle SAR or ZIP file is to be extracted|yes, if `sap_hana_installdir` is not defined| -|sap_hana_deployment_bundle_path_mn|Directory path on the managed node where the SAP HANA installation bundle SAR or ZIP file is located|yes, if `sap_hana_installdir` is not defined| +|sap_hana_deployment_bundle_is_on_managed_node|Define if the SAP HANA installation bundle file is available on the managed node|yes, if `sap_hana_installdir` is not defined| |sap_hana_deployment_bundle_file_name|File name of the SAP HANA installation bundle SAR or ZIP file|yes, if `sap_hana_installdir` is not defined| +|sap_hana_deployment_bundle_path_mn|Directory path on the managed node where the SAP HANA installation bundle SAR or ZIP file is located|yes, if `sap_hana_installdir` is not defined| |sap_hana_deployment_sapcar_file_name|File name of the SAPCAR executable|yes, if `sap_hana_installdir` is not defined and if the HANA installation bundle file type is "SAR"| |sap_hana_deployment_sapcar_path_mn|Directory path of the SAPCAR executable on the managed node|yes, if `sap_hana_installdir` is not defined and if the HANA installation bundle file type is "SAR"| -|sap_hana_deployment_bundle_is_on_managed_node|Define if the SAP HANA installation bundle file is available on the managed node|yes, if `sap_hana_installdir` is not defined| |sap_hana_deployment_bundle_is_on_control_node|Define if the SAP HANA installation bundle file is available on the control node|yes, if `sap_hana_installdir` is not defined| |sap_hana_deployment_bundle_path_cn|Directory path on the control node where the SAP HANA installation bundle SAR or ZIP file is located|yes, if `sap_hana_installdir` is not defined and if sap_hana_deployment_bundle_is_on_control_node is set to `yes`| |sap_hana_deployment_sapcar_path_cn|Directory path on the control node where the SAPCAR executable is located|yes, if `sap_hana_installdir` is not defined and if sap_hana_deployment_bundle_is_on_control_node is set to `yes` and if the HANA installation bundle file type is "SAR" | @@ -158,20 +158,23 @@ The upstream version of these role can be found [here](https://github.com/linux- ## Example Inventory ```yaml -sap_hana_deployment_bundle_path: /usr/local/src -sap_hana_deployment_bundle_sar_file_name: IMDB_SERVER20_045_0-80002031.SAR -sap_hana_deployment_sapcar_path: /usr/local/src -sap_hana_deployment_sapcar_file_name: SAPCAR_1311-80000935.EXE -sap_hana_deployment_root_password: "mysecretpassword" -sap_hana_deployment_sapadm_password: "mysecretpassword" +sap_hana_deployment_bundle_is_on_managed_node: yes +sap_hana_deployment_bundle_path_mn: /data/sap-download +sap_hana_deployment_bundle_file_name: IMDB_SERVER20_045_0-80002031.SAR +sap_hana_deployment_sapcar_path_mn: /usr/local/bin +sap_hana_deployment_sapcar_file_name: SAPCAR_1211-80000935.EXE +sap_hana_deployment_hana_extraction_path: /data/sap-install +sap_hana_deployment_root_password: "R3dh4t123" +sap_hana_deployment_sapadm_password: "R3dh4t123" +sap_hana_deployment_sidadm_password: "R3dh4t123" sap_hana_deployment_hana_sid: RHE sap_hana_deployment_hana_instance_number: "01" sap_hana_deployment_hana_env_type: development sap_hana_deployment_hana_mem_restrict: 'n' -sap_hana_deployment_hana_db_system_password: "mysecretpassword" -sap_hana_deployment_ase_user_password: "mysecretpassword" +sap_hana_deployment_hana_db_system_password: "R3dh4t123" +sap_hana_deployment_ase_user_password: "R3dh4t123" sap_hana_deployment_apply_license: true -sap_hana_deployment_license_path: /usr/local/src +sap_hana_deployment_license_path: /data/sap-license sap_hana_deployment_license_file_name: RHE.txt ``` diff --git a/tasks/provide_hana_installation_bundle.yml b/tasks/provide_hana_installation_bundle.yml index 8e7f822..a2b19b9 100644 --- a/tasks/provide_hana_installation_bundle.yml +++ b/tasks/provide_hana_installation_bundle.yml @@ -59,6 +59,12 @@ - name: Extract the SAP HANA SAPCAR archive block: + - name: Create the directory for extracting the SAP HANA installation bundle SAR file + file: + path: "{{ sap_hana_deployment_hana_extraction_path }}" + mode: '0755' + state: directory + - name: "Use SAPCAR to extract the SAP HANA installation bundle SAR file" command: >- {{ sap_hana_deployment_sapcar_path_mn }}/{{ sap_hana_deployment_sapcar_file_name }} @@ -75,10 +81,16 @@ when: - not(( sap_hana_deployment_bundle_path_mn is none ) or ( sap_hana_deployment_bundle_path_mn | trim == '')) - not(( sap_hana_deployment_bundle_file_name is none ) or (sap_hana_deployment_bundle_file_name | trim == '')) - - __sap_hana_preconfigure_fact_hana_bundle_file_type == "SAR" + - __sap_hana_preconfigure_fact_hana_bundle_file_type == 'SAR' - name: Extract the SAP HANA ZIP archive block: + - name: Create the directory for extracting the SAP HANA installation bundle ZIP file + file: + path: "{{ sap_hana_deployment_hana_extraction_path }}" + mode: '0755' + state: directory + - name: "Unzip the SAP HANA installation bundle ZIP file" unarchive: src: "{{ sap_hana_deployment_bundle_path_mn }}/{{ sap_hana_deployment_bundle_file_name }}" @@ -93,4 +105,4 @@ when: - not(( sap_hana_deployment_bundle_path_mn is none ) or ( sap_hana_deployment_bundle_path_mn | trim == '')) - not(( sap_hana_deployment_bundle_file_name is none ) or (sap_hana_deployment_bundle_file_name | trim == '')) - - __sap_hana_preconfigure_fact_hana_bundle_file_type == "ZIP" + - ((__sap_hana_preconfigure_fact_hana_bundle_file_type == 'ZIP') or (__sap_hana_preconfigure_fact_hana_bundle_file_type == 'zip')) From 75128bd01dd6c2fae57f66911d927c684d646ff6 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 20 Oct 2021 22:56:44 +0200 Subject: [PATCH 20/23] - Solves issues #42, #43, and #44 - Renamed all register variables according to naming convention - Added more examples to README.md --- README.md | 59 +++++++++++++-- ...cm-trc.sh => tail-f-hdblcm-install-trc.sh} | 0 tasks/ev_group.yml | 20 +++--- tasks/ev_user.yml | 8 +-- tasks/install_hana.yml | 71 ++++++++++++------- tasks/main.yml | 29 ++++++-- tasks/provide_hana_installation_bundle.yml | 18 ++++- 7 files changed, 151 insertions(+), 54 deletions(-) rename files/tmp/{tail-f-hdblcm-trc.sh => tail-f-hdblcm-install-trc.sh} (100%) diff --git a/README.md b/README.md index a583a1b..87d6b84 100644 --- a/README.md +++ b/README.md @@ -67,12 +67,15 @@ a user and group ID is chosen according to certain rules. or on a third node, if these files are available on the control node or on a third node. #### 3\. Run the SAP HANA installation - Once the SAP HANA installation files are available on the managed node, the installation on the is started on the managed node. - By specifying a valid argument to variable sap_hana_deployment_addhosts, a SAP HANA scale-out installation is performed on the - additional hosts. + Once the SAP HANA installation files are available on the managed node, the installation is started on the managed node. + By specifying a valid argument to variable `sap_hana_deployment_addhosts`, one or more SAP HANA hosts are added after the installation + on the first node has completed, meaning that the role will create a SAP HANA scale-out system. + If the variable `sap_hana_deployment_install_primary` is set to the value `n`, then instead of installing a fresh SAP HANA system, + additional hosts are added to an existing SAP HANA installation instead, using the argument to variable + `sap_hana_deployment_addhosts`. #### 4\. Apply the SAP HANA license - After the SAP HANA installation has completed, the SAP HANA license can be applied. + After a fresh SAP HANA installation has completed, the SAP HANA license can be applied. ## Role Variables @@ -80,7 +83,8 @@ a user and group ID is chosen according to certain rules. |:--------:|:----------------------------:|:---------:| |sap_hana_deployment_directories_permissions| Permissions for /hana/shared, /hana/data, /hana/log, and /usr/sap. | Yes| |sap_hana_deployment_set_permissions| Set or verify permissions for /hana/shared, /hana/data, /hana/log, and /usr/sap. If set to `yes`, permissions will be set. If set to `no`, permissions will be verified and the role will abort if one of the permissions is not set correctly. | Yes. Default is `no`.| -|sap_hana_installdir|SAP HANA directory in which hdblcm is located |No, if the location of a SAP HANA installation bundle file is specified using one of the variables below| +|sap_hana_deployment_install_primary|Whether you want to perform a fresh SAP HANA installation or add more hosts to an existing SAP HANA installation. The default is `y`.|yes| +|sap_hana_installdir|SAP HANA directory in which hdblcm is located |No, if the location of a SAP HANA installation bundle file is specified using some of the variables below| |sap_hana_deployment_hana_extraction_path|Directory path on the managed node to where the SAP HANA installation bundle SAR or ZIP file is to be extracted|yes, if `sap_hana_installdir` is not defined| |sap_hana_deployment_bundle_is_on_managed_node|Define if the SAP HANA installation bundle file is available on the managed node|yes, if `sap_hana_installdir` is not defined| |sap_hana_deployment_bundle_file_name|File name of the SAP HANA installation bundle SAR or ZIP file|yes, if `sap_hana_installdir` is not defined| @@ -115,7 +119,7 @@ a user and group ID is chosen according to certain rules. |sap_hana_deployment_system_restart|Restart system after machine reboot|no, defaulted to `n`| |sap_hana_deployment_create_initial_tenant|Create an initial tenant with the SAP HANA installation|yes, defaulted to `y`| |sap_hana_deployment_hostname|Hostname for the installation (e.g.if a virtual name is to be used)|yes, defaulted to the physical hostname| -|sap_hana_deployment_addhosts|a valid 'hostname:role=...,hostname:role=...' string as per SAP HANA Server Installation and Updated Guide. Example: 'host02:role=worker:workergroup=wg01:group=g01,host03:role=worker'|Only for HANA scale-out installation| +|sap_hana_deployment_addhosts|a valid 'hostname:role=...,hostname:role=...' string as per SAP HANA Server Installation and Updated Guide. Example: 'host02:role=worker:workergroup=wg01:group=g01,host03:role=worker'|Only for HANA scale-out installation or for adding additional hosts to an existing HANA installation| |sap_hana_deployment_xs_install|Install XS Advanced in the default tenant database|no, defaulted to `n`| |sap_hana_deployment_xs_path|XS Advanced App Working Path|Only if `sap_hana_deployment_xs_install` is `y`| |sap_hana_deployment_xs_orgname|Organization Name For Space "SAP"|Only if `sap_hana_deployment_xs_install` is `y`, defaulted to `orgname`| @@ -155,7 +159,7 @@ The upstream version of these role can be found [here](https://github.com/linux- - role: sap-hana-deployment ``` -## Example Inventory +## Example Inventory for an initial SAP HANA installation ```yaml sap_hana_deployment_bundle_is_on_managed_node: yes @@ -164,6 +168,7 @@ sap_hana_deployment_bundle_file_name: IMDB_SERVER20_045_0-80002031.SAR sap_hana_deployment_sapcar_path_mn: /usr/local/bin sap_hana_deployment_sapcar_file_name: SAPCAR_1211-80000935.EXE sap_hana_deployment_hana_extraction_path: /data/sap-install +sap_hana_deployment_hana_install_path: '/hana/shared' sap_hana_deployment_root_password: "R3dh4t123" sap_hana_deployment_sapadm_password: "R3dh4t123" sap_hana_deployment_sidadm_password: "R3dh4t123" @@ -178,6 +183,46 @@ sap_hana_deployment_license_path: /data/sap-license sap_hana_deployment_license_file_name: RHE.txt ``` +## Example Inventory for an initial SAP HANA scale-out installation + +```yaml +sap_hana_deployment_bundle_is_on_managed_node: yes +sap_hana_deployment_bundle_path_mn: /data/sap-download +sap_hana_deployment_bundle_file_name: IMDB_SERVER20_045_0-80002031.SAR +sap_hana_deployment_sapcar_path_mn: /usr/local/bin +sap_hana_deployment_sapcar_file_name: SAPCAR_1211-80000935.EXE +sap_hana_deployment_hana_extraction_path: /data/sap-install +sap_hana_deployment_hana_install_path: '/hana/shared' +sap_hana_deployment_root_password: "R3dh4t123" +sap_hana_deployment_sapadm_password: "R3dh4t123" +sap_hana_deployment_sidadm_password: "R3dh4t123" +sap_hana_deployment_hana_sid: RHE +sap_hana_deployment_hana_instance_number: "01" +sap_hana_deployment_hana_env_type: development +sap_hana_deployment_hana_mem_restrict: 'n' +sap_hana_deployment_hana_db_system_password: "R3dh4t123" +sap_hana_deployment_ase_user_password: "R3dh4t123" +sap_hana_deployment_addhosts: 'host02:role=worker:workergroup=wg01:group=g01,host03:role=worker' +sap_hana_deployment_apply_license: true +sap_hana_deployment_license_path: /data/sap-license +sap_hana_deployment_license_file_name: RHE.txt +``` + +## Example Inventory for adding a new host to an existing SAP HANA installation + +```yaml +sap_hana_deployment_install_primary: no +sap_hana_deployment_hana_install_path: '/hana/shared' +sap_hana_deployment_root_password: "R3dh4t123" +sap_hana_deployment_sapadm_password: "R3dh4t123" +sap_hana_deployment_sidadm_password: "R3dh4t123" +sap_hana_deployment_hana_sid: RHE +sap_hana_deployment_hana_instance_number: "01" +sap_hana_deployment_hana_db_system_password: "R3dh4t123" +sap_hana_deployment_addhosts: 'host04:role=standby' +sap_hana_deployment_install_primary: no +``` + ## License Apache License 2.0 diff --git a/files/tmp/tail-f-hdblcm-trc.sh b/files/tmp/tail-f-hdblcm-install-trc.sh similarity index 100% rename from files/tmp/tail-f-hdblcm-trc.sh rename to files/tmp/tail-f-hdblcm-install-trc.sh diff --git a/tasks/ev_group.yml b/tasks/ev_group.yml index f5242b5..f8eb516 100644 --- a/tasks/ev_group.yml +++ b/tasks/ev_group.yml @@ -3,22 +3,22 @@ - name: Evaluate if 'sapsys' group already exists shell: > set -o pipefail && grep sapsys /etc/group | cut -d ":" -f 3 - register: checkgroup + register: __sap_hana_deployment_register_checkgroup changed_when: false - failed_when: checkgroup.rc != 0 + ignore_errors: true - name: Get next available group ID in the 1000-1100 range shell: > awk -F: '{ uid[$3]=1 }END{ for(x=1000; x<=1100; x++) { if(uid[x] != ""){}else{print x; exit; }}}' /etc/group - register: nextgroupid - when: checkgroup.stdout | length = 0 + register: __sap_hana_deployment_register_nextgroupid + when: __sap_hana_deployment_register_checkgroup.stdout | length == 0 -- name: Set fact for Group ID when 'sapsys' group does not exist +- name: Set fact for group ID if 'sapsys' group does not exist set_fact: - sap_hana_deployment_hana_groupid: "{{ nextgroupid.stdout }}" - when: checkgroup.stdout | length = 0 + sap_hana_deployment_hana_groupid: "{{ __sap_hana_deployment_register_nextgroupid.stdout }}" + when: __sap_hana_deployment_register_checkgroup.stdout | length == 0 -- name: Set fact for Group ID when 'sapsys' group does exist +- name: Set fact for group ID if 'sapsys' group exists set_fact: - sap_hana_deployment_hana_groupid: "{{ checkgroup.stdout }}" - when: checkgroup.stdout | length > 0 \ No newline at end of file + sap_hana_deployment_hana_groupid: "{{ __sap_hana_deployment_register_checkgroup.stdout }}" + when: __sap_hana_deployment_register_checkgroup.stdout | length > 0 diff --git a/tasks/ev_user.yml b/tasks/ev_user.yml index 17fd6d5..3bb382c 100644 --- a/tasks/ev_user.yml +++ b/tasks/ev_user.yml @@ -3,10 +3,10 @@ - name: Get next available user ID in the 1000-1100 range shell: > awk -F: '{ uid[$3]=1 }END{ for(x=1000; x<=1100; x++) { if(uid[x] != ""){}else{ print x; exit; }}}' /etc/passwd - register: nextuserid + register: __sap_hana_deployment_register_nextuserid changed_when: false - failed_when: nextuserid.rc != 0 + failed_when: __sap_hana_deployment_register_nextuserid is failed -- name: Set fact for User ID +- name: Set fact for user ID set_fact: - sap_hana_deployment_hana_userid: "{{ nextuserid.stdout }}" \ No newline at end of file + sap_hana_deployment_hana_userid: "{{ __sap_hana_deployment_register_nextuserid.stdout }}" diff --git a/tasks/install_hana.yml b/tasks/install_hana.yml index 016f203..3486dd1 100644 --- a/tasks/install_hana.yml +++ b/tasks/install_hana.yml @@ -1,44 +1,63 @@ --- -- name: Check if file 'hdblcm' is in '{{ sap_hana_installdir }}' +- name: Check if file 'hdblcm' is in the SAP HANA installation directory stat: path: "{{ sap_hana_installdir + '/hdblcm' }}" - register: sap_hana_deployment_register_hdblcm_stat - failed_when: not sap_hana_deployment_register_hdblcm_stat.stat.exists + register: __sap_hana_deployment_register_hdblcm_stat + failed_when: not __sap_hana_deployment_register_hdblcm_stat.stat.exists + when: sap_hana_deployment_install_primary|d(true) - name: Create temporary directory to store the processed template tempfile: state: directory suffix: hanaconfig - register: tmpdir + register: __sap_hana_deployment_register_tmpdir - name: "Process HANA Configfile Template" template: src: "{{ role_path }}/templates/configfile.j2" - dest: "{{ tmpdir.path }}/configfile.cfg" + dest: "{{ __sap_hana_deployment_register_tmpdir.path }}/configfile.cfg" mode: '0644' - register: cftemplate + register: __sap_hana_deployment_register_cftemplate -- name: Copy file tail-f-hdblcm-trc.sh to "{{ tmpdir.path }}" - copy: - src: tmp/tail-f-hdblcm-trc.sh - dest: "{{ tmpdir.path }}/tail-f-hdblcm-trc.sh" - owner: root - group: root - mode: '0755' +- name: Install SAP HANA + block: -- name: Show how to watch the installation process in real time - debug: - msg: - - 'Once the task "Install SAP HANA" has started, you can use the following command' - - 'in a terminal session on the managed node to watch the installation progress in real time:' - - "{{ tmpdir.path }}/tail-f-hdblcm-trc.sh" - - 'Alternatively, you can run the following command on the control node:' - - "ssh {{ inventory_hostname }} {{ tmpdir.path }}/tail-f-hdblcm-trc.sh" + - name: Copy file tail-f-hdblcm-install-trc.sh to '{{ __sap_hana_deployment_register_tmpdir.path }}' + copy: + src: tmp/tail-f-hdblcm-install-trc.sh + dest: "{{ __sap_hana_deployment_register_tmpdir.path }}/tail-f-hdblcm-install-trc.sh" + owner: root + group: root + mode: '0755' -- name: Install SAP HANA - command: "./hdblcm {{ sap_hana_deployment_hdblcm_extraargs }} --configfile={{ tmpdir.path }}/configfile.cfg -b" - register: installhana + - name: Show how to watch the install process in real time + debug: + msg: + - 'Once the task "Perform the SAP HANA installation" has started, you can use the following command' + - 'in a terminal session on the managed node to watch the install progress in real time:' + - "{{ __sap_hana_deployment_register_tmpdir.path }}/tail-f-hdblcm-install-trc.sh" + - 'Alternatively, you can run the following command on the control node:' + - "ssh {{ inventory_hostname }} {{ __sap_hana_deployment_register_tmpdir.path }}/tail-f-hdblcm-install-trc.sh" + + - name: Perform the SAP HANA installation + command: "./hdblcm {{ sap_hana_deployment_hdblcm_extraargs }} --configfile={{ __sap_hana_deployment_register_tmpdir.path }}/configfile.cfg -b" + register: __sap_hana_deployment_register_hdblcm_install + args: + chdir: "{{ sap_hana_installdir }}" + changed_when: "'SAP HANA Lifecycle Management' in __sap_hana_deployment_register_hdblcm_install.stdout" + + when: sap_hana_deployment_install_primary|d(true) + +- name: Add hosts to the existing SAP HANA installation + command: "./hdblcm {{ sap_hana_deployment_hdblcm_extraargs }} --action=add_hosts --addhosts={{ sap_hana_deployment_addhosts }} --password={{ sap_hana_deployment_sidadm_password }} --configfile={{ __sap_hana_deployment_register_tmpdir.path }}/configfile.cfg -b" + register: __sap_hana_deployment_register_hdblcm_add_hosts args: - chdir: "{{ sap_hana_installdir }}" - changed_when: "'SAP HANA Lifecycle Management' in installhana.stdout" + chdir: "{{ sap_hana_deployment_hana_install_path }}/{{ sap_hana_deployment_hana_sid }}/hdblcm" + changed_when: "'SAP HANA Lifecycle Management' in __sap_hana_deployment_register_hdblcm_add_hosts.stdout" + when: not sap_hana_deployment_install_primary|d(true) + +- name: Show the result of hdblcm add_hosts + debug: + var: __sap_hana_deployment_register_hdblcm_add_hosts.stdout + when: not sap_hana_deployment_install_primary|d(true) diff --git a/tasks/main.yml b/tasks/main.yml index 8c3ebc8..c5866de 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,28 +1,49 @@ --- +- name: show sap_hana_deployment_hana_userid + debug: + var: sap_hana_deployment_hana_userid + +- name: show sap_hana_deployment_hana_groupid + debug: + var: sap_hana_deployment_hana_groupid + - import_tasks: ev_user.yml when: - - sap_hana_deployment_hana_userid == '' + - ((sap_hana_deployment_hana_userid is undefined) or + (sap_hana_deployment_hana_userid is none) or + (sap_hana_deployment_hana_userid | trim == '') + ) - not sap_hana_deployment_apply_license_only + - sap_hana_deployment_install_primary|d(true) - import_tasks: ev_group.yml when: - - sap_hana_deployment_hana_groupid == '' + - ((sap_hana_deployment_hana_groupid is undefined) or + (sap_hana_deployment_hana_groupid is none) or + (sap_hana_deployment_hana_groupid | trim == '') + ) - not sap_hana_deployment_apply_license_only + - sap_hana_deployment_install_primary|d(true) - import_tasks: password_facts.yml when: sap_hana_deployment_use_master_password == 'y' - import_tasks: set_or_verify_permissions.yml - when: not sap_hana_deployment_apply_license_only + when: + - not sap_hana_deployment_apply_license_only + - sap_hana_deployment_install_primary|d(true) - import_tasks: provide_hana_installation_bundle.yml when: - (( sap_hana_installdir is none ) or ( sap_hana_installdir | trim == '')) - not sap_hana_deployment_apply_license_only + - sap_hana_deployment_install_primary|d(true) - import_tasks: install_hana.yml when: not sap_hana_deployment_apply_license_only - import_tasks: apply_hana_license.yml - when: (sap_hana_deployment_apply_license_only or sap_hana_deployment_apply_license) + when: + - (sap_hana_deployment_apply_license_only or sap_hana_deployment_apply_license) + - sap_hana_deployment_install_primary|d(true) diff --git a/tasks/provide_hana_installation_bundle.yml b/tasks/provide_hana_installation_bundle.yml index a2b19b9..0a8dce8 100644 --- a/tasks/provide_hana_installation_bundle.yml +++ b/tasks/provide_hana_installation_bundle.yml @@ -12,6 +12,12 @@ - name: Copy the necessary SAP files from the control node block: + - name: Create the directory for storing the SAP HANA installation bundle file + file: + path: "{{ sap_hana_deployment_bundle_path_mn }}" + mode: '0755' + state: directory + - name: "cn: Copy the SAP HANA installation bundle file" copy: src: "{{ sap_hana_deployment_bundle_path_cn }}/{{ sap_hana_deployment_bundle_file_name }}" @@ -35,6 +41,12 @@ set_fact: __sap_hana_deployment_fact_remote_user: "{{ lookup('env', 'USER') }}" + - name: Create the directory for storing the SAP HANA installation bundle file + file: + path: "{{ sap_hana_deployment_bundle_path_mn }}" + mode: '0755' + state: directory + - name: "tn: Copy the SAP HANA installation bundle file" command: scp -p {{ sap_hana_deployment_sap_software_remote_location }}/{{ sap_hana_deployment_bundle_file_name }} \ {{ __sap_hana_deployment_fact_remote_user }}@{{ inventory_hostname }}:{{ sap_hana_deployment_bundle_path_mn }}/ @@ -70,10 +82,10 @@ {{ sap_hana_deployment_sapcar_path_mn }}/{{ sap_hana_deployment_sapcar_file_name }} -xvf {{ sap_hana_deployment_bundle_path_mn }}/{{ sap_hana_deployment_bundle_file_name }} -manifest SIGNATURE.SMF - register: sap_hana_deployment_register_extractbundle + register: __sap_hana_deployment_register_extractbundle args: chdir: "{{ sap_hana_deployment_hana_extraction_path }}" - changed_when: "'SAPCAR: processing archive' in sap_hana_deployment_register_extractbundle.stdout" + changed_when: "'SAPCAR: processing archive' in __sap_hana_deployment_register_extractbundle.stdout" - name: "SAR file: Set fact for the SAP HANA installer path" set_fact: @@ -97,7 +109,7 @@ dest: "{{ sap_hana_deployment_hana_extraction_path }}" remote_src: yes mode: '0755' - register: sap_hana_deployment_register_extractzip + register: __sap_hana_deployment_register_extractzip - name: "ZIP file: Set fact for the SAP HANA installer path" set_fact: From 3855a4c8230c92789412412e11388f82691a605b Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 20 Oct 2021 23:05:23 +0200 Subject: [PATCH 21/23] fix ansible-lint issue: long line 53 in install_hana.yml --- tasks/install_hana.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tasks/install_hana.yml b/tasks/install_hana.yml index 3486dd1..cdec988 100644 --- a/tasks/install_hana.yml +++ b/tasks/install_hana.yml @@ -50,7 +50,10 @@ when: sap_hana_deployment_install_primary|d(true) - name: Add hosts to the existing SAP HANA installation - command: "./hdblcm {{ sap_hana_deployment_hdblcm_extraargs }} --action=add_hosts --addhosts={{ sap_hana_deployment_addhosts }} --password={{ sap_hana_deployment_sidadm_password }} --configfile={{ __sap_hana_deployment_register_tmpdir.path }}/configfile.cfg -b" + command: "./hdblcm {{ sap_hana_deployment_hdblcm_extraargs }} --action=add_hosts + --addhosts={{ sap_hana_deployment_addhosts }} + --password={{ sap_hana_deployment_sidadm_password }} + --configfile={{ __sap_hana_deployment_register_tmpdir.path }}/configfile.cfg -b" register: __sap_hana_deployment_register_hdblcm_add_hosts args: chdir: "{{ sap_hana_deployment_hana_install_path }}/{{ sap_hana_deployment_hana_sid }}/hdblcm" From 13cf564a8b706645ddff91c675f8aa69f44f5aba Mon Sep 17 00:00:00 2001 From: Bernd Finger <> Date: Thu, 21 Oct 2021 12:27:02 +0200 Subject: [PATCH 22/23] - modified examples in README.md - renamed directory variables - modified some meta flags --- README.md | 18 ++++++++---------- defaults/main.yml | 8 ++++---- meta/main.yml | 9 ++++----- ...rectories-permissions-assert-loop-block.yml | 6 +++--- tasks/install_hana.yml | 12 ++++++++---- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 87d6b84..77556a1 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ a user and group ID is chosen according to certain rules. Once the SAP HANA installation files are available on the managed node, the installation is started on the managed node. By specifying a valid argument to variable `sap_hana_deployment_addhosts`, one or more SAP HANA hosts are added after the installation on the first node has completed, meaning that the role will create a SAP HANA scale-out system. + If the variable `sap_hana_deployment_install_primary` is set to the value `n`, then instead of installing a fresh SAP HANA system, additional hosts are added to an existing SAP HANA installation instead, using the argument to variable `sap_hana_deployment_addhosts`. @@ -159,15 +160,10 @@ The upstream version of these role can be found [here](https://github.com/linux- - role: sap-hana-deployment ``` -## Example Inventory for an initial SAP HANA installation +## Example Inventory for an initial SAP HANA installation - HANA software is already extracted on the managed node ```yaml -sap_hana_deployment_bundle_is_on_managed_node: yes -sap_hana_deployment_bundle_path_mn: /data/sap-download -sap_hana_deployment_bundle_file_name: IMDB_SERVER20_045_0-80002031.SAR -sap_hana_deployment_sapcar_path_mn: /usr/local/bin -sap_hana_deployment_sapcar_file_name: SAPCAR_1211-80000935.EXE -sap_hana_deployment_hana_extraction_path: /data/sap-install +sap_hana_installdir: /data/sap-install/SAP_HANA_DATABASE sap_hana_deployment_hana_install_path: '/hana/shared' sap_hana_deployment_root_password: "R3dh4t123" sap_hana_deployment_sapadm_password: "R3dh4t123" @@ -183,13 +179,16 @@ sap_hana_deployment_license_path: /data/sap-license sap_hana_deployment_license_file_name: RHE.txt ``` -## Example Inventory for an initial SAP HANA scale-out installation +## Example Inventory for an initial SAP HANA scale-out installation - HANA software SAR file is available on the control node ```yaml -sap_hana_deployment_bundle_is_on_managed_node: yes +sap_hana_deployment_bundle_is_on_managed_node: no +sap_hana_deployment_bundle_is_on_control_node: yes sap_hana_deployment_bundle_path_mn: /data/sap-download +sap_hana_deployment_bundle_path_cn: /data/sap-download sap_hana_deployment_bundle_file_name: IMDB_SERVER20_045_0-80002031.SAR sap_hana_deployment_sapcar_path_mn: /usr/local/bin +sap_hana_deployment_sapcar_path_cn: /data/sap-download sap_hana_deployment_sapcar_file_name: SAPCAR_1211-80000935.EXE sap_hana_deployment_hana_extraction_path: /data/sap-install sap_hana_deployment_hana_install_path: '/hana/shared' @@ -220,7 +219,6 @@ sap_hana_deployment_hana_sid: RHE sap_hana_deployment_hana_instance_number: "01" sap_hana_deployment_hana_db_system_password: "R3dh4t123" sap_hana_deployment_addhosts: 'host04:role=standby' -sap_hana_deployment_install_primary: no ``` ## License diff --git a/defaults/main.yml b/defaults/main.yml index 963d1e7..4785688 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -3,10 +3,10 @@ # Directories and their permissions to set or verify sap_hana_deployment_directories_permissions: - - { name: /hana/shared, value: '0755' } - - { name: /hana/data, value: '0755' } - - { name: /hana/log, value: '0755' } - - { name: /usr/sap, value: '0755' } + - { name: /hana/shared, mode: '0755' } + - { name: /hana/data, mode: '0755' } + - { name: /hana/log, mode: '0755' } + - { name: /usr/sap, mode: '0755' } # If the following variable is set to 'yes', set permissions of # the directories in sap_hana_deployment_directories_permissions to the specified values. diff --git a/meta/main.yml b/meta/main.yml index 8f6e798..945a938 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,12 +1,11 @@ galaxy_info: author: Red Hat SAP Community of Practice - description: Deploys `SAP HANA` on the given host(s) + description: Deploys SAP HANA + company: Red Hat, Inc. license: Apache - min_ansible_version: 2.5 + min_ansible_version: 2.7 platforms: - name: EL versions: [ 7, 8 ] - - galaxy_tags: [ 'hana', 'rhel', 'sap' ] - + galaxy_tags: [ 'sap', 'hana', 'rhel' ] dependencies: [] diff --git a/tasks/directories-permissions-assert-loop-block.yml b/tasks/directories-permissions-assert-loop-block.yml index 069699a..f23de54 100644 --- a/tasks/directories-permissions-assert-loop-block.yml +++ b/tasks/directories-permissions-assert-loop-block.yml @@ -7,9 +7,9 @@ path: "{{ line_item.name }}" register: __sap_hana_deployment_register_stat -- name: Assert that permissions of {{ line_item.name }} are '{{ line_item.value }}' +- name: Assert that permissions of {{ line_item.name }} are '{{ line_item.mode }}' assert: - that: "__sap_hana_deployment_register_stat.stat.mode == '{{ line_item.value }}'" + that: "__sap_hana_deployment_register_stat.stat.mode == '{{ line_item.mode }}'" fail_msg: "FAIL: Directory {{ line_item.name }} has permissions '{{ __sap_hana_deployment_register_stat.stat.mode }}' - but needs to have '{{ line_item.value }}'!" + but needs to have '{{ line_item.mode }}'!" success_msg: "PASS: Directory {{ line_item.name }} has correct permissions '{{ __sap_hana_deployment_register_stat.stat.mode }}'." diff --git a/tasks/install_hana.yml b/tasks/install_hana.yml index cdec988..eee623d 100644 --- a/tasks/install_hana.yml +++ b/tasks/install_hana.yml @@ -13,7 +13,7 @@ suffix: hanaconfig register: __sap_hana_deployment_register_tmpdir -- name: "Process HANA Configfile Template" +- name: Process HANA configfile template template: src: "{{ role_path }}/templates/configfile.j2" dest: "{{ __sap_hana_deployment_register_tmpdir.path }}/configfile.cfg" @@ -41,7 +41,9 @@ - "ssh {{ inventory_hostname }} {{ __sap_hana_deployment_register_tmpdir.path }}/tail-f-hdblcm-install-trc.sh" - name: Perform the SAP HANA installation - command: "./hdblcm {{ sap_hana_deployment_hdblcm_extraargs }} --configfile={{ __sap_hana_deployment_register_tmpdir.path }}/configfile.cfg -b" + command: "./hdblcm {{ sap_hana_deployment_hdblcm_extraargs }} + --configfile={{ __sap_hana_deployment_register_tmpdir.path }}/configfile.cfg + -b" register: __sap_hana_deployment_register_hdblcm_install args: chdir: "{{ sap_hana_installdir }}" @@ -50,10 +52,12 @@ when: sap_hana_deployment_install_primary|d(true) - name: Add hosts to the existing SAP HANA installation - command: "./hdblcm {{ sap_hana_deployment_hdblcm_extraargs }} --action=add_hosts + command: "./hdblcm {{ sap_hana_deployment_hdblcm_extraargs }} + --action=add_hosts --addhosts={{ sap_hana_deployment_addhosts }} --password={{ sap_hana_deployment_sidadm_password }} - --configfile={{ __sap_hana_deployment_register_tmpdir.path }}/configfile.cfg -b" + --configfile={{ __sap_hana_deployment_register_tmpdir.path }}/configfile.cfg + -b" register: __sap_hana_deployment_register_hdblcm_add_hosts args: chdir: "{{ sap_hana_deployment_hana_install_path }}/{{ sap_hana_deployment_hana_sid }}/hdblcm" From 188fee43c41801626ec2b9d174da3fd9bbaa8367 Mon Sep 17 00:00:00 2001 From: Bernd Finger <> Date: Thu, 21 Oct 2021 12:39:15 +0200 Subject: [PATCH 23/23] variable name change --- tasks/set_or_verify_permissions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/set_or_verify_permissions.yml b/tasks/set_or_verify_permissions.yml index b572251..8bcff1c 100644 --- a/tasks/set_or_verify_permissions.yml +++ b/tasks/set_or_verify_permissions.yml @@ -4,7 +4,7 @@ file: path: "{{ line_item.name }}" state: directory - mode: "{{ line_item.value }}" + mode: "{{ line_item.mode }}" with_items: "{{ sap_hana_deployment_directories_permissions }}" loop_control: loop_var: line_item