sap_hana_install Ansible Role

Ansible role for SAP HANA Installation

Support Status

The support status of this role is: “Fully supported”

Requirements

The dependencies of this role should be automatically installed when installing the collection with ansible-galaxy.

For installing the dependencies manually, use the following command:

ansible-galaxy install -vv -r meta/collection-requirements.yml

Configure your system for the installation of SAP HANA

SAP HANA Software Installation .SAR Files

Place the following files in directory /software/hana or in any other directory specified by variable
sap_hana_install_software_directory:

  1. The SAPCAR executable for the correct hardware architecture

  2. The SAP HANA Installation .SAR file
  3. Optional - SAP HANA Components .SAR files
  4. Optional - SAP Host Agent .SAR file

Sample Directory Contents - with .SAR files

If more than one SAPCAR EXE file is present in the software directory, the role will select the latest version
for the current hardware architecture. Alternatively, the file name of the SAPCAR EXE file can also be set with
variable sap_hana_install_sapcar_filename. Example:

sap_hana_install_sapcar_filename: SAPCAR_1115-70006178.EXE

If more than one SAR file for a certain software product is present in the software directory, the automatic
handling of such SAR files will fail after extraction, when moving the newly created product directories
(like SAP_HOST_AGENT) to already existing destinations.
For avoiding such situations, use following variable to provide a list of SAR files to extract:

sap_hana_install_sarfiles.

Example:

sap_hana_install_sarfiles:
  - SAPHOSTAGENT54_54-80004822.SAR
  - IMDB_SERVER20_060_0-80002031.SAR

If there is a file named <filename>.sha256 in the software download directory
sap_hana_install_software_directory which contains the checksum and the file name similar to the output
of the sha256sum command, the role will examine the sha256sum for the corresponding SAPCAR or SAR file and the
processing will continue only if the checksum matches.

Extracted SAP HANA Software Installation Files

This role will detect if there is a file hdblcm already present in the directory specified by variable
sap_hana_install_software_extract_directory or in any directory below. If If found, it will skip
the .SAR extraction phase and proceed with the installation.

The default for sap_hana_install_software_extract_directory is {{ sap_hana_install_software_directory }}/extracted but it
can be set to a different directory.

If this role is executed on more than one host in parallel and the software extraction directory is shared among those hosts,
the role will only extract the files on the first host on which the extraction has started. The role will proceed on the other hosts
after the extraction of SAR files has completed.

If NFS is used for sharing the SAP HANA installation media between the nodes, then it is required to define
sap_hana_install_configfile_directory. The default for sap_hana_install_configfile_directory is
“{{ sap_hana_install_software_extract_directory }}/configfiles”. This variable should point to a non nfs path. After installation,
if a cleanup of configfile is required, then set sap_hana_install_cleanup_configfile_directory as true. If a cleanup of
software extract directory is required then set sap_hana_install_cleanup_extract_directory as true. The default value for both
these cleanup actions are false.

SAP HANA hdblcm Configfile Processing

By default, the hdblcm configfile will be created dynamically in each run, as follows: After the role has
found the hdblcm command or extracted the SAP HANA SAR file, it will call the hdblcm command with the
option --dump_configfile_template to create a configfile template, which will then be converted into
a Jinja2 configfile template according to the following rules: For each hdblcm parameter, the value
will be either the value of the role variable prepended by the role name and an underscore, or a
default (if present in the hdblcm configfile template).

Example: The value of hdblcm parameter system_usage will be set to the value of role variable
sap_hana_install_system_usage or to custom in case the role variable has not been set.

The result of the templating is a new, customized hdblcm configfile, which will be used by the
hdblcm command for the SAP HANA installation.

This provides great flexibility for handling different SAP HANA releases, which typically have a slightly
different set of hdblcm parameters. For preparing the installation of a new SAP HANA system, it can be useful
to run the role with tag sap_hana_install_preinstall first. This will display the full path names of the
hdblcm configfile template, the Jinja2 template, and the result of the templating. By comparing the hdblcm
configfile template with the templating result (indicated by placeholder TEMPLATING_RESULT below), you
can quickly check if all role variables for the hdblcm command are set correctly and make any necessary
adjustments to the role variables.

For displaying only the modified default lines, in two columns, use:
# diff -y --suppress-common-lines hdblcm_configfile_template.cfg TEMPLATING_RESULT

For checking and comparing all non-empty hdblcm parameter settings, use:
# diff -y <(awk 'BEGIN{FS="="}/^[a-z]/&&length($2)>0{print $0}' hdblcm_configfile_template.cfg) <(awk 'BEGIN{FS="="}/^[a-z]/&&length($2)>0{print $0}' TEMPLATING_RESULT)

Note: If there is a file named configfile.cfg in the directory specified by role variable
sap_hana_install_configfile_directory, this file will be used and no dynamic hdblcm configfile processing
will be performed. Be aware that when using this file, any modifications to role variables after creation
of this file will not be reflected.

Further Variables and Parameters

Input Parameters

If the variable sap_hana_install_check_sidadm_user is set to no, the role will install SAP HANA even
if the sidadm user exists. Default is yes, in which case the installation will not be performed if the
sidadm user exists.

The variable sap_hana_install_new_system determines if the role will perform a fresh SAP HANA installation
or if it will add further hosts to an existing SAP HANA system as specified by variable
sap_hana_install_addhosts. Default is yes for a fresh SAP HANA installation.

The role can be configured to also set the required firewall ports for SAP HANA. If this is desired, set
the variable sap_hana_install_update_firewall to yes (default is no). The firewall ports are defined
in a variable which is compatible with the variable structure used by Linux System Role firewall.
The firewall ports for SAP HANA are defined in member port of the first field of variable
sap_hana_install_firewall (sap_hana_install_firewall[0].port), see file defaults/main.yml. If the
member state is set to enabled, the ports will be enabled. If the member state is set to disabled,
the ports will be disabled, which might be useful for testing.

Certain parameters have identical meanings, for supporting different naming schemes in playbooks and inventories.
You can find those in the task Rename some variables used by hdblcm configfile of the file tasks/main.yml.
Example: The parameter sap_hana_install_number, which is used by the role to define the hdblm parameter number
(= SAP HANA instance number) can be defined by setting sap_hana_instance_number, sap_hana_install_instance_nr,
sap_hana_install_instance_number, or sap_hana_install_number. The order of precedence is from left to right.

Default Parameters

Please check the default parameters file for more information on other parameters that can be used as an input

Execution

Sample Ansible Playbook Execution

Sample playbooks

Sample playbook for installing a new scale-up (=single node) SAP HANA system

---
- hosts: all
  collections:
    - redhat.sap_install
  become: true
  vars:
    sap_hana_install_software_directory: /software/hana
    sap_hana_install_common_master_password: 'NewPass$321'
    sap_hana_install_sid: 'H01'
    sap_hana_install_instance_nr: '00'
  roles:
    - sap_hana_install

Sample playbook for installing a new scale-out SAP HANA system

---
- hosts: all
  collections:
    - redhat.sap_install
  become: true
  vars:
    sap_hana_install_software_directory: /software/hana
    sap_hana_install_common_master_password: 'NewPass$321'
    sap_hana_install_root_password: 'NewPass$321'
    sap_hana_install_addhosts: 'host2:role=worker,host3:role=worker:group=g02,host4:role=standby:group=g02'
    sap_hana_install_sid: 'H01'
    sap_hana_install_instance_nr: '00'
  roles:
    - sap_hana_install

Sample playbook for adding additional nodes to an existing SAP HANA installation

---
- hosts: all
  collections:
    - redhat.sap_install
  become: true
  vars:
    sap_hana_install_software_directory: /software/hana
    sap_hana_install_new_system: no
    sap_hana_install_addhosts: 'host2:role=worker,host3:role=worker:group=g02,host4:role=standby:group=g02'
    sap_hana_install_common_master_password: 'NewPass$321'
    sap_hana_install_root_password: 'NewPass$321'
    sap_hana_install_sid: 'H01'
    sap_hana_install_instance_nr: '00'
  roles:
    - sap_hana_install

You can find more complex playbooks in directory playbooks of the collection community.sap_install.

Flow

New SAP HANA Installation

Perform Initial Checks

These checks are only performed if sap_hana_install_force is set to true. Its default value is false

Pre-Install

Note: For each SAPCAR or SAR file called or used by the role, if variable sap_hana_install_verify_checksums
is set to yes, the role will perform a checksum verification against a specific or global checksum file.

If this file exists, copy it to a temporary directory for use by the hdblcm command. Be aware that when using this file,
any modifications to role variables after creation of this file will not be reflected.

If this file is not present, perform the following three steps:

SAP HANA Install

Post-Install

Add hosts to an existing SAP HANA Installation

Pre-Install

SAP HANA Add Hosts

Post-Install

Tags

With the following tags, the role can be called to perform certain activities only:

Sample call for only processing the SAPCAR and SAR files and creating the hdblcm configfile:

# ansible-playbook sap-hana-install.yml --tags=sap_hana_install_preinstall --skip-tags=sap_hana_install_chown_hana_directories

Sample call for only processing the SAPCAR files:

# ansible-playbook sap-hana-install.yml --tags=sap_hana_install_prepare_sapcar

Sample call for only processing the SAPCAR and SAR files, without extracting the SAR files:

# ansible-playbook sap-hana-install.yml --tags=sap_hana_install_prepare_sarfiles --skip-tags=sap_hana_install_extract_sarfiles

Sample call for only displaying the SAP HANA hdblcm command line:

# ansible-playbook sap-hana-install.yml --tags=sap_hana_install_hdblcm_commandline

License

Apache license 2.0

Author Information

Red Hat for SAP Community of Practice, IBM Lab for SAP Solutions, Markus Koch, Thomas Bludau, Bernd Finger, Than Ngo, Rainer Leber