sap_hana_preconfigure Ansible Role

This role installs additional required packages and performs additional configuration steps for installing and running SAP HANA.
If you want to configure a RHEL system for the installation and later usage of SAP HANA, you have to first run role sap_general_preconfigure
and then role sap_hana_preconfigure. However, if we wish to run SLES for HANA, you may run only this role.

Support Status

The support status of this role is: “Fully supported for RHEL managed nodes”

Requirements

The role requires additional collections which are specified in meta/collection-requirements.yml. Before using this role,
make sure that the required collections are installed, for example by using the following command:

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

To use this role, your system needs to be configured with the basic requirements for SAP NetWeaver or SAP HANA. This is typically done by running role sap_general_preconfigure (for RHEL managed nodes before RHEL 7.6, community maintained role sap-base-settings can be used).

It is also strongly recommended to run role linux-system-roles.timesync for all systems running SAP HANA, to maintain an identical system time, before or after running role sap_hana_preconfigure.

Managed nodes need to be properly registered to a repository source and have at least the following Red Hat repositories accessible (see also example playbook):

for RHEL 7.x:

for RHEL 8.x:

for RHEL 9.x:

for SLES 15.x:

For details on configuring Red Hat, see the knowledge base article: How to subscribe SAP HANA systems to the Update Services for SAP Solutions). If you set role parameter sap_hana_preconfigure_enable_sap_hana_repos to yes, the role can enable these repos.

To install HANA on Red Hat Enterprise Linux 7, 8, or 9, you need some additional packages which are contained in the

repository.

To get this repository you need to have one of the following products:

To get a personal developer edition of RHEL for SAP solutions, please register as a developer and download the developer edition.

NOTE: This is a regular RHEL installation DVD as RHEL for SAP Solutions is no additional
product but only a special bundling. The subscription grants you access to the additional
packages through our content delivery network (CDN) after installation.

For supported RHEL releases click here.

Details on configuring SLES repositories can be found on the following articles for on-premise systems or BYOS cloud images

It is also important that your disks are setup according to the SAP storage requirements for SAP HANA. This BLOG is also quite helpful when sizing HANA systems.
You can use the storage role to automate this process

If you want to use this system in production, make sure that the time service is configured correctly. You can use rhel-system-roles to automate this.

Note

For finding out which SAP notes will be used by this role for Red Hat systems, please check the contents of variable __sap_hana_preconfigure_sapnotes in files vars/*.yml (choose the file which matches your OS distribution and version).

For SLES, notes are applied using the saptune service. Saptune supports a number of solutions. A solution implements several SAP notes. The default solution for this role is ‘HANA’. To see a list of supported solutions and the notes that they implement, you can run saptune solution list on the command line.

Do not run this role against an SAP HANA or other production system. The role will enforce a certain configuration on the managed node(s), which might not be intended.

Changes

1) Previous versions of this role used the variable sap_hana_preconfigure_use_tuned_where_possible to switch between either tuned settings
or kernel command line settings (where applicable).
The current version modifies this behavior:

2) Previous versions of this role used variable sap_hana_preconfigure_selinux_state to set the SELinux state to disabled.
As the role sap_general_preconfigure already allows to specify the desired SELinux state, and as sap_general_preconfigure
is always run before sap_hana_preconfigure, there is no need any more to let sap_hana_preconfigure configure the SELinux state.
The same applies to the assertion of the SELinux state.

3) SLES systems are now configured using saptune rather than the ansible implementation of the notes.

Role Input Parameters

Minimum required parameters:

This role does not require any parameter to be set in the playbook or inventory.

sap_hana_preconfigure_config_all

If set to false, the role will only execute or verify the installation or configuration steps of SAP notes.

Default is to perform installation and configuration steps.

sap_hana_preconfigure_installation

If sap_hana_preconfigure_config_all is set to false, set this variable to true to perform only the

installation steps of SAP notes.

sap_hana_preconfigure_configuration

If sap_hana_preconfigure_config_all is set to false, set this variable to true to perform only the

configuration steps of SAP notes for which the corresponding SAP notes parameters have been set to true.

Example:

sap_hana_preconfigure_config_all: false
sap_hana_preconfigure_configuration: true
sap_hana_preconfigure_2772999_04: true
sap_hana_preconfigure_2382421: true

sap_hana_preconfigure_assert

If set to true, the role will run in assertion mode instead of the default configuration mode.

sap_hana_preconfigure_assert_all_config

In assertion mode, the role will check either tuned or static settings.

If this parameter is set to to true, the role will check both tuned and static settings.

sap_hana_preconfigure_assert_ignore_errors

In assertion mode, the role will abort when encountering any assertion error.

If this parameter is set to false, the role will not abort when encountering an assertion error.

This is useful if the role is used for reporting a system’s SAP notes compliance.

sap_hana_preconfigure_system_roles_collection

Set which Ansible Collection to use for the Linux System Roles.

For community/upstream, use ‘fedora.linux_system_roles’

For the RHEL System Roles for SAP, or for Red Hat Automation Hub, use ‘redhat.rhel_system_roles’

sap_hana_preconfigure_min_rhel_release_check

Check the RHEL release against parameter sap_hana_preconfigure_supported_rhel_minor_releases, which is a list of

known SAP HANA supported RHEL minor releases. By default, the role will display a message and continue running if

the RHEL release is not part of that list. If set to true, the role will fail in such a case.

sap_hana_preconfigure_supported_rhel_minor_releases

Use this parameter to set your own list of SAP HANA supported RHEL minor releases.

sap_hana_preconfigure_enable_sap_hana_repos

Set to ‘true’ to enable the SAP HANA required RHEL repos.

This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose.

The related parameters are sap_general_preconfigure_enable_repos and sap_general_preconfigure_use_hana_repos.

sap_hana_preconfigure_req_repos_redhat_7_x86_64

Use this parameter to set your own list of SAP HANA required RHEL 7 repos on x86_64’

This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose.

The related parameters are sap_general_preconfigure_enable_repos and sap_general_preconfigure_req_repos.

sap_hana_preconfigure_req_repos_redhat_7_ppc64le

Use this parameter to set your own list of SAP HANA required RHEL 7 repos on ppc64le’

This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose.

The related parameters are sap_general_preconfigure_enable_repos and sap_general_preconfigure_req_repos.

sap_hana_preconfigure_req_repos_redhat_8_x86_64

Use this parameter to set your own list of SAP HANA required RHEL 8 repos on x86_64’

This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose.

The related parameters are sap_general_preconfigure_enable_repos and sap_general_preconfigure_req_repos.

sap_hana_preconfigure_req_repos_redhat_8_ppc64le

Use this parameter to set your own list of SAP HANA required RHEL 8 repos on ppc64le’

This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose.

The related parameters are sap_general_preconfigure_enable_repos and sap_general_preconfigure_req_repos.

sap_hana_preconfigure_req_repos_redhat_9_x86_64

Use this parameter to set your own list of SAP HANA required RHEL 9 repos on x86_64’

This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose.

The related parameters are sap_general_preconfigure_enable_repos and sap_general_preconfigure_req_repos.

sap_hana_preconfigure_req_repos_redhat_9_ppc64le

Use this parameter to set your own list of SAP HANA required RHEL 9 repos on ppc64le’

This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose.

The related parameters are sap_general_preconfigure_enable_repos and sap_general_preconfigure_req_repos.

sap_hana_preconfigure_set_minor_release

Use this parameter to set the RHEL minor release, which is required for SAP HANA.

The related parameter is sap_general_preconfigure_set_minor_release.

sap_hana_preconfigure_create_directories

Set to false if you do not want the SAP HANA directories to be created by the role.

The SAP HANA directories will always be created if sap_hana_preconfigure_modify_selinux_labels

(see below) is set to true, no matter how sap_hana_preconfigure_create_directories is set.

sap_hana_preconfigure_hana_directories

List of SAP HANA directories to be created.

sap_hana_preconfigure_modify_selinux_labels

For compatibility of SAP HANA with SELinux in enforcing mode, the role will recursively add

the usr_t label to directories and files in the directories where HANA is installed.

If relabeling not desired, set this parameter false.

If the variable is set to true, the SAP HANA directories will be created no matter

how the variable sap_hana_preconfigure_create_directories (see above) is set.

sap_hana_preconfigure_packages

List of RHEL packages to be installed for SAP HANA. For RHEL 8 and later, you can choose to install either the default list

or a list of the minimum required packages for SAP HANA server (parameter __sap_hana_preconfigure_packages_min_install).

sap_hana_preconfigure_min_package_check

SAP HANA requires certain minimum package versions to be supported. These minimum levels are listed in SAP Note 2235581.

Set this parameter to false if you want to ignore these requirements.

sap_hana_preconfigure_update

Set this parameter to true to update the system to the latest package levels.

By setting the parameter sap_general_preconfigure_set_minor_release of the

role sap_general_preconfigure to true, you can install the most recent package updates

without updating to a more recent RHEL minor release.

sap_hana_preconfigure_reboot_ok

Set to true if you want to perform a reboot at the end of the role, if necessary.

sap_hana_preconfigure_fail_if_reboot_required

If sap_hana_preconfigure_reboot_ok is set to false, which is the default, a reboot requirement should not

remain unnoticed. For this reason, we let the role fail. Set this parameter to false to override this behavior.

Can be useful if you want to implement your own reboot handling.

sap_hana_preconfigure_kernel_parameters

Network related linux kernel parameter settings for SAP HANA on all hardware platforms.

sap_hana_preconfigure_kernel_parameters_ppc64le

Network related linux kernel parameter settings for platform ppc64le.

sap_hana_preconfigure_use_netapp_settings_nfs

Set to true to also set NetApp NFS required kernel parameters.

sap_hana_preconfigure_use_netapp_settings_nfsv3

If sap_hana_preconfigure_use_netapp_settings_nfs is set to true and NFS Version 3 is to be used,

this parameter must be set to true as well.

sap_hana_preconfigure_install_ibm_power_tools

Set this parameter to false to not install the IBM Power Systems service and productivity tools.

sap_hana_preconfigure_add_ibm_power_repo

Set this parameter to false if you do not want to add the IBM Power tools repository (e.g. because the packages

are already available on the local network). The IBM Power Systems service and productivity tools will only

be installed if the variable sap_hana_preconfigure_install_ibm_power_tools is set to true, which is the default.

sap_hana_preconfigure_ibm_power_repo_url

URL of the IBM Power tools repository.

sap_hana_preconfigure_ppcle_mtu9000_if

List of interfaces for which the MTU size will be set to 9000.

sap_hana_preconfigure_ppcle_tso_if

List of interfaces for which the tso flag will be set.

sap_hana_preconfigure_use_tuned

Use tuned for configuring most of the kernel settings for SAP HANA

Set this parameter to false to use static kernel settings

sap_hana_preconfigure_tuned_profile

Name of the SAP HANA tuned tuned profile to enable (RHEL).

sap_hana_preconfigure_modify_grub_cmdline_linux

Set this parameter to true to modify the Grub boot command line.

sap_hana_preconfigure_run_grub2_mkconfig

By default, the role will run grub2-mkconfig to update the Grub configuration if necessary.

Set this parameter to false if this is not desired.

sap_hana_preconfigure_db_group_name

Use this parameter to specify the name of the RHEL group which is used for the database processes.

It will be used to configure process limits as per step “Configuring Process Resource Limits” of SAP note 2772999.

Example:

sap_hana_preconfigure_db_group_name: dba

sap_hana_preconfigure_saptune_version

Version of saptune to install (SLES for SAP Applications).

This will replace the current installed version if present, even downgrade if necessary.

sap_hana_preconfigure_saptune_solution

The saptune solution to apply (SLES for SAP Applications).

sap_hana_preconfigure_saptune_azure

On Azure, TCP timestamps, reuse and recycle should be disabled (SLES for SAP Applications).

Set this parameter to true on Azure.

Example Playbook

Simple playbook, named sap+hana.yml:

---
- hosts: all
  roles:
    - role: sap_general_preconfigure
    - role: sap_hana_preconfigure

Simple playbook for an extended check (assert) run, named sap+hana-assert.yml:

---
- hosts: all
  vars:
    sap_general_preconfigure_assert: yes
    sap_general_preconfigure_assert_ignore_errors: yes
    sap_hana_preconfigure_assert: yes
    sap_hana_preconfigure_assert_ignore_errors: yes
  roles:
    - role: sap_general_preconfigure
    - role: sap_hana_preconfigure

Example Usage

Normal run, for configuring server host_1 for SAP HANA:

ansible-playbook sap+hana.yml -l host_1

Extended Check (assert) run, not aborting if an error has been found:

ansible-playbook sap+hana-assert.yml -l host_1

Same as above, with a nice compact and colored output, this time for two hosts:

ansible-playbook sap+hana-assert.yml -l host_1,host_2 |
awk '{sub ("    \"msg\": ", "")}
  /TASK/{task_line=$0}
  /fatal:/{fatal_line=$0; nfatal[host]++}
  /...ignoring/{nfatal[host]--; if (nfatal[host]<0) nfatal[host]=0}
  /^[a-z]/&&/: \[/{gsub ("\\[", ""); gsub ("]", ""); gsub (":", ""); host=$2}
  /SAP note/{print "\033[30m[" host"] "$0}
  /FAIL:/{nfail[host]++; print "\033[31m[" host"] "$0}
  /WARN:/{nwarn[host]++; print "\033[33m[" host"] "$0}
  /PASS:/{npass[host]++; print "\033[32m[" host"] "$0}
  /INFO:/{print "\033[34m[" host"] "$0}
  /changed/&&/unreachable/{print "\033[30m[" host"] "$0}
  END{print ("---"); for (var in npass) {printf ("[%s] ", var); if (nfatal[var]>0) {
        printf ("\033[31mFATAL ERROR!!! Playbook might have been aborted!!!\033[30m Last TASK and fatal output:\n"); print task_line, fatal_line
     }
     else printf ("\033[31mFAIL: %d  \033[33mWARN: %d  \033[32mPASS: %d\033[30m\n", nfail[var], nwarn[var], npass[var])}}'

Note: For terminals with dark background, replace the color code 30m by 37m.
In case you need to make an invisible font readable on a terminal with dark background, run the following command in the terminal:

printf "\033[37mreadable font\n"

In case you need to make an invisible font readable on a terminal with bright background, run the following command in the terminal:

printf "\033[30mreadable font\n"

Contribution

Please read the developer guidelines if you want to contribute

License

Apache license 2.0

Author Information

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