---

# supported RHEL 7 minor releases for SAP HANA:
__sap_hana_preconfigure_supported_rhel_minor_releases:
  - "7.6"
  - "7.7"
  - "7.9"

# required repos for RHEL 7:
__sap_hana_preconfigure_req_repos_redhat_7_6_x86_64:
  - "rhel-7-server-e4s-rpms"
  - "rhel-sap-hana-for-rhel-7-server-e4s-rpms"

__sap_hana_preconfigure_req_repos_redhat_7_6_ppc64le:
  - "rhel-7-for-power-le-e4s-rpms"
  - "rhel-sap-hana-for-rhel-7-for-power-le-e4s-rpms"

__sap_hana_preconfigure_req_repos_redhat_7_7_x86_64:
  - "rhel-7-server-e4s-rpms"
  - "rhel-sap-hana-for-rhel-7-server-e4s-rpms"

__sap_hana_preconfigure_req_repos_redhat_7_7_ppc64le:
  - "rhel-7-for-power-le-e4s-rpms"
  - "rhel-sap-hana-for-rhel-7-for-power-le-e4s-rpms"

__sap_hana_preconfigure_req_repos_redhat_7_8_x86_64:
  - "rhel-7-server-rpms"
  - "rhel-sap-hana-for-rhel-7-server-rpms"

__sap_hana_preconfigure_req_repos_redhat_7_8_ppc64le:
  - "rhel-7-for-power-le-rpms"
  - "rhel-sap-hana-for-rhel-7-for-power-le-rpms"

__sap_hana_preconfigure_req_repos_redhat_7_9_x86_64:
  - "rhel-7-server-rpms"
  - "rhel-sap-hana-for-rhel-7-server-rpms"

__sap_hana_preconfigure_req_repos_redhat_7_9_ppc64le:
  - "rhel-7-for-power-le-rpms"
  - "rhel-sap-hana-for-rhel-7-for-power-le-rpms"

# required SAP notes for RHEL 7:
__sap_hana_preconfigure_sapnotes_versions_x86_64:
  - { number: '2009879', version: '28' }
  - { number: '2292690', version: '38' }
  - { number: '2382421', version: '40' }
  - { number: '3024346', version: '3' }

__sap_hana_preconfigure_sapnotes_versions_ppc64le:
  - { number: '2009879', version: '28' }
  - { number: '2055470', version: '85' }
  - { number: '2292690', version: '38' }
  - { number: '2382421', version: '40' }
  - { number: '3024346', version: '3' }

__sap_hana_preconfigure_sapnotes_versions: "{{ lookup('vars','__sap_hana_preconfigure_sapnotes_versions_' + ansible_architecture) }}"

# In SAP Note 2235581, certain minimal required packages for the different RHEL 7 minor releases are listed.
# The following will assign them properly to __sap_hana_preconfigure_min_pkgs.
# If variable __sap_hana_preconfigure_min_packages_VERSION is not defined,
# variable __sap_hana_preconfigure_min_pkgs will be undefined as well.

__sap_hana_preconfigure_min_packages_7_2_x86_64:
  - [ 'kernel', '3.10.0-327.62.4.el7' ]
  - [ 'systemd', '219-19.el7_2.4' ]

__sap_hana_preconfigure_min_packages_7_2_ppc64le:
  - [ 'kernel', '3.10.0-327.62.4.el7' ]
  - [ 'systemd', '219-19.el7_2.4' ]

__sap_hana_preconfigure_min_packages_7_3_x86_64:
  - [ 'kernel', '3.10.0-514.36.5.el7' ]
  - [ 'glibc', '2.17-157.el7_3.5' ]
  - [ 'tuned-profiles-sap-hana', '2.7.1-3.el7_3.3' ]

__sap_hana_preconfigure_min_packages_7_3_ppc64le:
  - [ 'kernel', '3.10.0-514.36.5.el7' ]
  - [ 'glibc', '2.17-157.el7_3.5' ]
  - [ 'tuned-profiles-sap-hana', '2.7.1-3.el7_3.3' ]

# Attention: SAP note 2812427 requires more recent package kernel-3.10.0-693.58.1, covered by role sap-preconfigure
__sap_hana_preconfigure_min_packages_7_4_x86_64:
  - [ 'kernel', '3.10.0-693.11.6.el7' ]
  - [ 'tuned-profiles-sap-hana', '2.8.0-5.el7_4.2' ]

__sap_hana_preconfigure_min_packages_7_4_ppc64le:
  - [ 'kernel', '3.10.0-693.11.6.el7' ]
  - [ 'tuned-profiles-sap-hana', '2.8.0-5.el7_4.2' ]

__sap_hana_preconfigure_min_packages_7_5_x86_64:

__sap_hana_preconfigure_min_packages_7_5_ppc64le:

# Attention: SAP note 2812427 requires more recent package kernel-3.10.0-957.35.1, covered by role sap-preconfigure
__sap_hana_preconfigure_min_packages_7_6_x86_64:
  - [ 'kernel', '3.10.0-957.1.3.el7' ]

__sap_hana_preconfigure_min_packages_7_6_ppc64le:
  - [ 'kernel', '3.10.0-957.1.3.el7' ]

# SAP note 2292690:
__sap_hana_preconfigure_min_packages_7_7_x86_64:
  - [ 'kernel', '3.10.0-1062.21.1.el7' ]

__sap_hana_preconfigure_min_packages_7_7_ppc64le:
  - [ 'kernel', '3.10.0-1062.26.1.el7' ]

__sap_hana_preconfigure_min_packages_7_8_x86_64:

__sap_hana_preconfigure_min_packages_7_8_ppc64le:

__sap_hana_preconfigure_min_packages_7_9_x86_64:
  - [ 'kernel', '3.10.0-1160.11.1.el7' ]

__sap_hana_preconfigure_min_packages_7_9_ppc64le:
  - [ 'kernel', '3.10.0-1160.11.1.el7' ]

__sap_hana_preconfigure_min_pkgs: "{{ lookup('vars','__sap_hana_preconfigure_min_packages_' + ansible_distribution_version|string|replace (\".\", \"_\") + '_' + ansible_architecture|string) }}"

__sap_hana_preconfigure_packages:
# SAP note 2009879:
  - chrony
  - xfsprogs
  - libaio
  - net-tools
  - bind-utils
  - gtk2
  - libicu
  - xulrunner
  - tcsh
  - sudo
  - libssh2
  - expect
  - cairo
  - graphviz
  - iptraf-ng
  - krb5-workstation
  - krb5-libs
  - libpng12
  - nfs-utils
  - lm_sensors
  - rsyslog
  - openssl
  - PackageKit-gtk3-module
  - libcanberra-gtk2
  - libtool-ltdl
  - xorg-x11-xauth
  - numactl
  - tuned
# SAP note 2292690:
  - tuned-profiles-sap-hana
  - compat-sap-c++-5
# SAP note 2455582:
  - compat-sap-c++-6
# SAP note 2593824:
  - compat-sap-c++-7
  - libatomic
# Likely required for future HANA 2.0 versions:
  - compat-sap-c++-9

# libtool-ltdl: See https://answers.sap.com/questions/476177/hana-db-installation-ended-with-exit-code-127.html
# This is required since HANA 2 SPS 03, and so we always install it.

__sap_hana_preconfigure_ibm_power_repo_url: 'http://public.dhe.ibm.com/software/server/POWER/Linux/yum/download/ibm-power-repo-latest.noarch.rpm'

# As per https://www14.software.ibm.com/support/customercare/sas/f/lopdiags/home.html :
__sap_hana_preconfigure_required_ppc64le:
  - librtas
  - src
  - rsct.core.utils
  - rsct.core
  - rsct.basic
  - rsct.opt.storagerm
  - devices.chrp.base.ServiceRM
  - DynamicRM
  - ncurses-libs
  - readline
  - sqlite
  - sg3_utils
  - libgcc
  - libstdc++
  - zlib
  - iprutils
  - lsvpd
  - libvpd
  - libservicelog
  - servicelog
  - powerpc-utils
  - powerpc-utils-python
  - ppc64-diag
  - IBMinvscout

# Network related kernel parameters as set in SAP Note 2382421:
__sap_hana_preconfigure_kernel_parameters_default:
# The following two parameter should always be set:
  - { name: net.core.somaxconn, value: 4096 }
  - { name: net.ipv4.tcp_max_syn_backlog, value: 8192 }
# The following two parameters are automatically set by SAP Host Agent
#  - { name: net.ipv4.ip_local_port_range, value: "40000 61000" }
#  - { name: net.ipv4.ip_local_reserved_ports, value: -> SAP NOTE 2477204 }
# The following two parameters do not work when communicating with hosts behind NAT firewall:
#  - { name: net.ipv4.tcp_tw_reuse, value: 1 }
#  - { name: net.ipv4.tcp_tw_recycle, value: 1 }
# The following parameter should always be set but might not work on Azure (see SAP Note 2382421):
  - { name: net.ipv4.tcp_timestamps, value: 1 }
# The following parameter should always be set:
  - { name: net.ipv4.tcp_slow_start_after_idle, value: 0 }
# Tune the next four parameters for low latency system replication:
#  - { net.ipv4.tcp_wmem, value }
#  - { net.ipv4.tcp_rmem, value }
#  - { net.core.wmem_max, value }
#  - { net.core.rmem_max, value }
# Should be set correctly already on most systems, according to SAP Note 2382421:
#  - { net.ipv4.tcp_window_scaling, 1 }
# The following only applies to HANA 1 <= 122.14 and HANA 2 SPS00.
# So we do not change the default.
#  - { name: net.ipv4.tcp_syn_retries, value: 8 }

# Network related kernel parameters for ppc64le:
__sap_hana_preconfigure_kernel_parameters_default_ppc64le:
  - { name: net.core.rmem_max, value: 56623104 }
  - { name: net.core.wmem_max, value: 56623104 }
  - { name: net.ipv4.tcp_rmem, value: "65536 262088 56623104" }
  - { name: net.ipv4.tcp_wmem, value: "65536 262088 56623104" }
  - { name: net.ipv4.tcp_mem, value: "56623104 56623104 56623104" }

# Network related kernel parameters for NetApp NFS, as set in SAP Note 3024346:
__sap_hana_preconfigure_kernel_parameters_netapp_nfs:
  - { name: net.core.rmem_max, value: 16777216 }
  - { name: net.core.wmem_max, value: 16777216 }
  - { name: net.ipv4.tcp_rmem, value: "4096 131072 16777216" }
  - { name: net.ipv4.tcp_wmem, value: "4096 16384 16777216" }
  - { name: net.core.netdev_max_backlog, value: 300000 }
# already set in SAP note 2382421:
#  - { name: net.ipv4.tcp_slow_start_after_idle, value: 0 }
  - { name: net.ipv4.tcp_no_metrics_save, value: 1 }
  - { name: net.ipv4.tcp_moderate_rcvbuf, value: 1 }
  - { name: net.ipv4.tcp_window_scaling, value: 1 }
# already set in SAP note 2382421:
#  - { name: net.ipv4.tcp_timestamps, value: 1 }
  - { name: net.ipv4.tcp_sack, value: 1 }

# yamllint disable rule:commas rule:colons
__sap_hana_preconfigure_packages_and_services:
  abrtd:     { pkg: 'abrt',            svc: 'abrtd',     systemd_enabled: 'no', systemd_state: 'stopped', svc_status: 'disabled', svc_state: 'inactive' }
  abrt-ccpp: { pkg: 'abrt-addon-ccpp', svc: 'abrt-ccpp', systemd_enabled: 'no', systemd_state: 'stopped', svc_status: 'disabled', svc_state: 'inactive' }
  numad:     { pkg: 'numad',           svc: 'numad',     systemd_enabled: 'no', systemd_state: 'stopped', svc_status: 'disabled', svc_state: 'inactive' }
  kdump:     { pkg: 'kexec-tools',     svc: 'kdump',     systemd_enabled: 'no', systemd_state: 'stopped', svc_status: 'disabled', svc_state: 'inactive' }
  firewalld: { pkg: 'firewalld',       svc: 'firewalld', systemd_enabled: 'no', systemd_state: 'stopped', svc_status: 'disabled', svc_state: 'inactive' }
# yamllint enable rule:commas rule:colons
