Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Solve issue redhat-sap#21.
Browse files Browse the repository at this point in the history
  • Loading branch information
berndfinger committed Sep 10, 2021
1 parent 9663419 commit 091603f
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 4 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`|
Expand Down
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
64 changes: 63 additions & 1 deletion tasks/hana_deploy.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 091603f

Please sign in to comment.