diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5191af6dd..749c4fee4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,30 @@ community.sap_install Release Notes .. contents:: Topics +1.5.1 +Release Summary +--------------- +- Release Date: 2025-01-15 + +This is a bugfix release of the `community.sap_install` collection. + +Minor Changes +------------- +- sap_ha_pacemaker_cluster: enable Simple Mount on RHEL (https://github.com/sap-linuxlab/community.sap_install/pull/931) +- sap_ha_pacemaker_cluster/SUSE: Rework SAPHanaSR-angi pre-steps and add SLES 16 vars (https://github.com/sap-linuxlab/community.sap_install/pull/928) +- sap_swpm, sap_general_preconfigure: Add variables for sap_install FQCN collection name for calling roles (https://github.com/sap-linuxlab/community.sap_install/pull/925) +- sap_general_preconfigure: Implement SAP note 2369910 (https://github.com/sap-linuxlab/community.sap_install/pull/914) +- sap_ha_pacemaker_cluster: ANGI on RHEL and small improvements (https://github.com/sap-linuxlab/community.sap_install/pull/911) +- sap_*_preconfigure, sap_ha_pacemaker_cluster: Reworked loading vars (https://github.com/sap-linuxlab/community.sap_install/pull/910) + +Bugfixes +-------- +- sap_swpm: Use master password only when necessary (https://github.com/sap-linuxlab/community.sap_install/pull/920) +- sap_swpm: Fix error when using tag sap_swpm_generate_inifile (https://github.com/sap-linuxlab/community.sap_install/pull/918) +- sap_swpm: Fix error when installing SAP NW750 JAVA or SOLMAN72SR2 JAVA instances (https://github.com/sap-linuxlab/community.sap_install/pull/916) +- sap_install_media_detect: Fix wrong sap_export_solman_java detection (https://github.com/sap-linuxlab/community.sap_install/pull/913) + + v1.5.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index b81cefc31..2b6cad3c1 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -273,3 +273,20 @@ releases: - sap_ha_install_anydb_ibmdb2: Linting and sles bug fixes (https://github.com/sap-linuxlab/community.sap_install/pull/803) ' release_date: '2024-11-29' + 1.5.1: + changes: + release_summary: '| Release Date: 2025-01-15 + minor_changes: + - sap_ha_pacemaker_cluster: enable Simple Mount on RHEL (https://github.com/sap-linuxlab/community.sap_install/pull/931) + - sap_ha_pacemaker_cluster/SUSE: Rework SAPHanaSR-angi pre-steps and add SLES 16 vars (https://github.com/sap-linuxlab/community.sap_install/pull/928) + - sap_swpm, sap_general_preconfigure: Add variables for sap_install FQCN collection name for calling roles (https://github.com/sap-linuxlab/community.sap_install/pull/925) + - sap_general_preconfigure: Implement SAP note 2369910 (https://github.com/sap-linuxlab/community.sap_install/pull/914) + - sap_ha_pacemaker_cluster: ANGI on RHEL and small improvements (https://github.com/sap-linuxlab/community.sap_install/pull/911) + - sap_*_preconfigure, sap_ha_pacemaker_cluster: Reworked loading vars (https://github.com/sap-linuxlab/community.sap_install/pull/910) + bugfixes: + - sap_swpm: Use master password only when necessary (https://github.com/sap-linuxlab/community.sap_install/pull/920) + - sap_swpm: Fix error when using tag sap_swpm_generate_inifile (https://github.com/sap-linuxlab/community.sap_install/pull/918) + - sap_swpm: Fix error when installing SAP NW750 JAVA or SOLMAN72SR2 JAVA instances (https://github.com/sap-linuxlab/community.sap_install/pull/916) + - sap_install_media_detect: Fix wrong sap_export_solman_java detection (https://github.com/sap-linuxlab/community.sap_install/pull/913) + ' + release_date: '2025-01-15' diff --git a/galaxy.yml b/galaxy.yml index bb5e3566f..c32a16517 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -11,7 +11,7 @@ namespace: community name: sap_install # The version of the collection. Must be compatible with semantic versioning -version: 1.5.0 +version: 1.5.1 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/roles/sap_general_preconfigure/defaults/main.yml b/roles/sap_general_preconfigure/defaults/main.yml index 5cef8b737..a016e7c68 100644 --- a/roles/sap_general_preconfigure/defaults/main.yml +++ b/roles/sap_general_preconfigure/defaults/main.yml @@ -31,6 +31,9 @@ sap_general_preconfigure_system_roles_collection: 'fedora.linux_system_roles' # - fedora.linux_system_roles # - redhat.rhel_system_roles +sap_general_preconfigure_sap_install_collection: 'community.sap_install' +# Set which Ansible Collection to use when calling sap_install roles. + sap_general_preconfigure_enable_repos: false # Set to `true` if you want the role to enable the repos as configured by the following repo related parameters. # The default is `false`, meaning that the role will not enable repos. @@ -166,4 +169,7 @@ sap_general_preconfigure_domain: "{{ sap_domain | d(ansible_domain) }}" # Configuring Process Resource Limits # Example: See README.md +# in SAP Note 2369910 SAP requires English locale +# If you want to define the locale set this to e.g. en_US.UTF-8 +sap_general_preconfigure_default_locale: "" # END: Default Variables for sap_general_preconfigure diff --git a/roles/sap_general_preconfigure/meta/argument_specs.yml b/roles/sap_general_preconfigure/meta/argument_specs.yml index aaf3cf4a1..03a598c8c 100644 --- a/roles/sap_general_preconfigure/meta/argument_specs.yml +++ b/roles/sap_general_preconfigure/meta/argument_specs.yml @@ -75,6 +75,12 @@ argument_specs: required: false type: str + sap_general_preconfigure_sap_install_collection: + default: 'community.sap_install' + description: Set which Ansible Collection to use when calling sap_install roles. + required: false + type: str + sap_general_preconfigure_enable_repos: default: false description: @@ -341,3 +347,11 @@ argument_specs: sap_general_preconfigure_db_group_name: 'dba' required: false type: str + + sap_general_preconfigure_default_locale: + description: + - Use this variable to specify the default system locale. + example: + sap_general_preconfigure_default_locale: 'en_US.UTF-8' + required: false + type: str diff --git a/roles/sap_general_preconfigure/tasks/RedHat/assert-installation.yml b/roles/sap_general_preconfigure/tasks/RedHat/assert-installation.yml index 135c2ccd4..bba57f19d 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/assert-installation.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/assert-installation.yml @@ -49,7 +49,7 @@ - name: Assert - Get info about enabled repos ansible.builtin.shell: set -o pipefail && subscription-manager repos --list-enabled | awk '/Repo ID:/{print $NF}' register: __sap_general_preconfigure_register_enabled_repos_assert - changed_when: no + changed_when: false - name: Assert that all required repos are enabled ansible.builtin.assert: @@ -69,8 +69,8 @@ - name: Detect if and how the minor RHEL release is set ansible.builtin.shell: set -o pipefail && subscription-manager release | awk 'NF==2{printf $NF}NF!=2{print}' register: __sap_general_preconfigure_register_subscription_manager_release_assert - changed_when: no - ignore_errors: yes + changed_when: false + ignore_errors: true - name: Assert that the RHEL release is locked correctly ansible.builtin.assert: @@ -104,7 +104,7 @@ - name: Check if required RHEL 7 package groups are installed # noqa command-instead-of-shell ansible.builtin.shell: "{{ __sap_general_preconfigure_fact_yum_group_list_installed_command_assert }}" register: __sap_general_preconfigure_register_yum_group_assert - changed_when: no + changed_when: false - name: Assert that all required RHEL 7 package groups are installed ansible.builtin.assert: @@ -133,7 +133,7 @@ - name: Check if required RHEL 8 environment groups are installed # noqa command-instead-of-shell ansible.builtin.shell: "{{ __sap_general_preconfigure_fact_yum_envgroup_list_installed_command_assert }}" register: __sap_general_preconfigure_register_yum_envgroup_assert - changed_when: no + changed_when: false - name: Assert that all required RHEL 8 environment groups are installed ansible.builtin.assert: @@ -162,7 +162,7 @@ set -o pipefail && yum info installed {{ __sap_general_preconfigure_required_ppc64le | map('quote') | join(' ') }} | awk '/Name/{n=$NF}/Version/{v=$NF}/Release/{r=$NF}/Description/{printf ("%s\n", n)}' register: __sap_general_preconfigure_register_required_ppc64le_packages_assert - changed_when: no + changed_when: false when: ansible_architecture == "ppc64le" ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}" @@ -223,9 +223,9 @@ with_list: "{{ __sap_general_preconfigure_min_pkgs }}" loop_control: loop_var: pkg - check_mode: no + check_mode: false register: __sap_general_preconfigure_register_minpkglist_assert - changed_when: no + changed_when: false - name: Assert that minimum required package versions are installed # If the output includes the string "is already installed" (case 2b), we have a PASS. Otherwise, it's a FAIL. @@ -237,12 +237,12 @@ loop_control: loop_var: line_item label: "" - ignore_errors: yes + ignore_errors: true - name: Report if no minimum required package version is defined for this RHEL release ansible.builtin.debug: msg: "INFO: No minimum required package version defined (variable __sap_general_preconfigure_min_pkgs)." - ignore_errors: yes + ignore_errors: true when: not __sap_general_preconfigure_min_pkgs | d([]) # Reason for noqa: The yum module appears to not support the check-update option @@ -265,7 +265,7 @@ - name: Report if checking for possible package updates is not requested ansible.builtin.debug: msg: "INFO: Not checking for possible package updates (variable sap_general_preconfigure_update)." - ignore_errors: yes + ignore_errors: true when: not sap_general_preconfigure_update - name: "Assert - Set needs-restarting command in case of RHEL 7" diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-dns-name-resolution.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-dns-name-resolution.yml index 091a538d1..c9465aa5d 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-dns-name-resolution.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-dns-name-resolution.yml @@ -7,7 +7,7 @@ fail_msg: "FAIL: The DNS domain is not configured! So variable 'sap_general_preconfigure_domain' needs to be configured!" success_msg: "PASS: The DNS domain is configured." # ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}" - ignore_errors: yes + ignore_errors: true - name: Assert that variable sap_general_preconfigure_domain is set ansible.builtin.assert: @@ -25,8 +25,8 @@ - name: Check if IP address for sap_general_preconfigure_hostname.sap_general_preconfigure_domain is resolved correctly ansible.builtin.command: dig {{ sap_general_preconfigure_hostname }}.{{ sap_general_preconfigure_domain }} +short register: __sap_general_preconfigure_register_dig_short_assert - ignore_errors: yes - changed_when: no + ignore_errors: true + changed_when: false when: "'bind-utils' in ansible_facts.packages" - name: Assert that ansible_default_ipv4.address is set diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-etc-hosts.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-etc-hosts.yml index 282226b8b..cd8771b94 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-etc-hosts.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-etc-hosts.yml @@ -11,8 +11,8 @@ - name: Check if ipv4 address, FQDN, and hostname are once in /etc/hosts ansible.builtin.command: awk 'BEGIN{a=0}/^{{ sap_general_preconfigure_ip }}\s/&&/\s{{ sap_general_preconfigure_hostname }}.{{ sap_general_preconfigure_domain }}\s/&&(/\s{{ sap_general_preconfigure_hostname }}\s/||/\s{{ sap_general_preconfigure_hostname }}$/){a++}END{print a}' /etc/hosts register: __sap_general_preconfigure_register_ipv4_fqdn_sap_hostname_once_assert - ignore_errors: yes - changed_when: no + ignore_errors: true + changed_when: false - name: Assert that ipv4 address, FQDN, and hostname are once in /etc/hosts ansible.builtin.assert: @@ -25,8 +25,8 @@ - name: Count the number of sap_general_preconfigure_ip ({{ sap_general_preconfigure_ip }}) entries in /etc/hosts ansible.builtin.command: awk 'BEGIN{a=0}/^{{ sap_general_preconfigure_ip }}\s/{a++}END{print a}' /etc/hosts register: __sap_general_preconfigure_register_sap_ip_once_assert - ignore_errors: yes - changed_when: no + ignore_errors: true + changed_when: false - name: Assert that there is exactly one line containing {{ sap_general_preconfigure_ip }} in /etc/hosts ansible.builtin.assert: @@ -40,8 +40,8 @@ /\s{{ sap_general_preconfigure_hostname }}.{{ sap_general_preconfigure_domain }}\s/|| /\s{{ sap_general_preconfigure_hostname }}.{{ sap_general_preconfigure_domain }}$/{a++}END{print a}' /etc/hosts register: __sap_general_preconfigure_register_fqdn_once_assert - ignore_errors: yes - changed_when: no + ignore_errors: true + changed_when: false - name: Assert that there is just one line containing {{ sap_general_preconfigure_hostname }}.{{ sap_general_preconfigure_domain }} in /etc/hosts ansible.builtin.assert: @@ -55,8 +55,8 @@ /\s{{ sap_general_preconfigure_hostname }}\s/|| /\s{{ sap_general_preconfigure_hostname }}$/{a++}END{print a}' /etc/hosts register: __sap_general_preconfigure_register_sap_hostname_once_assert - ignore_errors: yes - changed_when: no + ignore_errors: true + changed_when: false - name: Assert that there is just one line containing {{ sap_general_preconfigure_hostname }} in /etc/hosts ansible.builtin.assert: @@ -68,8 +68,8 @@ - name: Test hostname -s ansible.builtin.shell: test "$(hostname -s)" = "$(hostname)" register: __sap_general_preconfigure_register_hostname_s_assert - ignore_errors: yes - changed_when: no + ignore_errors: true + changed_when: false - name: Assert that hostname -s matches the output of hostname ansible.builtin.assert: @@ -81,8 +81,8 @@ - name: Test hostname -f ansible.builtin.shell: test "$(hostname -f)" = "$(hostname).$(hostname -d)" register: __sap_general_preconfigure_register_hostname_f_assert - ignore_errors: yes - changed_when: no + ignore_errors: true + changed_when: false - name: Assert that hostname -f matches the output of hostname.hostname -d ansible.builtin.assert: diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-firewall.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-firewall.yml index 4b0a0de8d..ab5326cf2 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-firewall.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-firewall.yml @@ -18,9 +18,9 @@ - name: Get status of firewalld # noqa command-instead-of-module ansible.builtin.command: systemctl status firewalld register: __sap_general_preconfigure_register_firewalld_status_assert - ignore_errors: yes - changed_when: no - no_log: yes + ignore_errors: true + changed_when: false + no_log: true - name: Assert that firewalld is disabled ansible.builtin.assert: diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-hostname.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-hostname.yml index 83ff80aa2..60374bc18 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-hostname.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-hostname.yml @@ -4,8 +4,8 @@ - name: Check if hostname is set ansible.builtin.command: hostname register: __sap_general_preconfigure_register_hostname_assert - ignore_errors: yes - changed_when: no + ignore_errors: true + changed_when: false - name: Assert that the output of hostname matches the content of variable sap_general_preconfigure_hostname ansible.builtin.assert: diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-kernel-parameters-loop-block.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-kernel-parameters-loop-block.yml index a5d2fa4b5..2660929cd 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-kernel-parameters-loop-block.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-kernel-parameters-loop-block.yml @@ -6,8 +6,8 @@ - name: Get {{ line_item.name }} from {{ sap_general_preconfigure_etc_sysctl_sap_conf }} ansible.builtin.shell: awk 'BEGIN{FS="="}/{{ line_item.name }}/{gsub ("^\\s*", "", $NF); print $NF}' {{ sap_general_preconfigure_etc_sysctl_sap_conf }} register: __sap_general_preconfigure_register_sysctl_sap_conf_kernel_parameter_assert - changed_when: no - ignore_errors: yes + changed_when: false + ignore_errors: true when: __sap_general_preconfigure_register_stat_sysctl_sap_conf_assert.stat.exists - name: Assert that {{ line_item.name }} is set correctly in {{ sap_general_preconfigure_etc_sysctl_sap_conf }} @@ -23,8 +23,8 @@ - name: Get {{ line_item.name }} from sysctl ansible.builtin.shell: sysctl -n {{ line_item.name }} | awk '{gsub ("\t", " "); print}' register: __sap_general_preconfigure_register_sysctl_kernel_parameter_assert - changed_when: no - ignore_errors: yes + changed_when: false + ignore_errors: true - name: Assert that {{ line_item.name }} is set correctly as per sysctl ansible.builtin.assert: diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-nofile-limits.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-nofile-limits.yml index ef40e8843..ac4e3a5cb 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-nofile-limits.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-nofile-limits.yml @@ -4,8 +4,8 @@ - name: Check if the hard limit of nofile for group sapsys is 1048576 ansible.builtin.command: awk '!/^#/&&/sapsys/&&/nofile/&&/hard/{print $NF}' /etc/security/limits.d/99-sap.conf register: __sap_general_preconfigure_register_limits_sap_conf_nofile_hard_assert - changed_when: no - ignore_errors: yes + changed_when: false + ignore_errors: true when: - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.exists - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.isreg @@ -25,8 +25,8 @@ - name: Check if the soft limit of nofile for group sapsys is 1048576 ansible.builtin.command: awk '!/^#/&&/sapsys/&&/nofile/&&/soft/{print $NF}' /etc/security/limits.d/99-sap.conf register: __sap_general_preconfigure_register_limits_sap_conf_nofile_soft_assert - changed_when: no - ignore_errors: yes + changed_when: false + ignore_errors: true when: - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.exists - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.isreg @@ -46,8 +46,8 @@ - name: Get the hard limit of nofile for the database group ansible.builtin.command: awk '!/^#/&&/@{{ sap_general_preconfigure_db_group_name }}/&&/nofile/&&/hard/{print $NF}' /etc/security/limits.d/99-sap.conf register: __sap_general_preconfigure_register_limits_sap_conf_db_group_nofile_hard_assert - changed_when: no - ignore_errors: yes + changed_when: false + ignore_errors: true when: - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.exists - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.isreg @@ -67,8 +67,8 @@ - name: Get the soft limit of nofile for the database group ansible.builtin.command: awk '!/^#/&&/@{{ sap_general_preconfigure_db_group_name }}/&&/nofile/&&/soft/{print $NF}' /etc/security/limits.d/99-sap.conf register: __sap_general_preconfigure_register_limits_sap_conf_db_group_nofile_soft_assert - changed_when: no - ignore_errors: yes + changed_when: false + ignore_errors: true when: - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.exists - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.isreg diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-nproc-limits.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-nproc-limits.yml index db05b0f1d..703202013 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-nproc-limits.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-nproc-limits.yml @@ -4,8 +4,8 @@ - name: Check if the hard limit of nproc for group sapsys is unlimited ansible.builtin.command: awk '/sapsys/&&/nproc/&&/hard/{print $NF}' /etc/security/limits.d/99-sap.conf register: __sap_general_preconfigure_register_limits_sap_conf_nproc_hard_assert - changed_when: no - ignore_errors: yes + changed_when: false + ignore_errors: true when: - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.exists - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.isreg @@ -25,8 +25,8 @@ - name: Check if the soft limit of nproc for group sapsys is unlimited ansible.builtin.command: awk '/sapsys/&&/nproc/&&/soft/{print $NF}' /etc/security/limits.d/99-sap.conf register: __sap_general_preconfigure_register_limits_sap_conf_nproc_soft_assert - changed_when: no - ignore_errors: yes + changed_when: false + ignore_errors: true when: - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.exists - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.isreg @@ -46,8 +46,8 @@ - name: Get the hard limit of nproc for the database group ansible.builtin.command: awk '/@{{ sap_general_preconfigure_db_group_name }}/&&/nproc/&&/hard/{print $NF}' /etc/security/limits.d/99-sap.conf register: __sap_general_preconfigure_register_limits_sap_conf_db_group_nproc_hard_assert - changed_when: no - ignore_errors: yes + changed_when: false + ignore_errors: true when: - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.exists - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.isreg @@ -69,8 +69,8 @@ - name: Get the soft limit of nproc for the database group ansible.builtin.command: awk '/@{{ sap_general_preconfigure_db_group_name }}/&&/nproc/&&/soft/{print $NF}' /etc/security/limits.d/99-sap.conf register: __sap_general_preconfigure_register_limits_sap_conf_db_group_nproc_soft_assert - changed_when: no - ignore_errors: yes + changed_when: false + ignore_errors: true when: - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.exists - __sap_general_preconfigure_register_stat_limits_sap_conf_assert.stat.isreg diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-selinux.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-selinux.yml index 36e1c0c7d..b2df48f28 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-selinux.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-selinux.yml @@ -16,21 +16,21 @@ - name: Info about SELinux being set to 'enforcing' ansible.builtin.debug: msg: "INFO: The SELinux state has been set to 'enforcing' (variable sap_general_preconfigure_selinux_state)." - ignore_errors: yes + ignore_errors: true when: "sap_general_preconfigure_selinux_state == 'enforcing'" - name: Warn about how SELinux would be set when role is run in normal mode ansible.builtin.debug: msg: "INFO: When running in normal mode, the role will set the SELinux state to '{{ sap_general_preconfigure_selinux_state }}' (variable sap_general_preconfigure_selinux_state)." - ignore_errors: yes + ignore_errors: true when: "sap_general_preconfigure_selinux_state != 'enforcing'" - name: "Check if the permanent configuration of the SELinux state is '{{ sap_general_preconfigure_selinux_state }}'" ansible.builtin.command: awk 'BEGIN{FS="="}/^SELINUX=/{print $NF}' /etc/selinux/config register: __sap_general_preconfigure_register_selinux_conf_assert changed_when: false - ignore_errors: yes + ignore_errors: true when: __sap_general_preconfigure_register_stat_selinux_conf_assert.stat.isreg - name: "Assert that the permanent configuration of the SELinux state is set to '{{ sap_general_preconfigure_selinux_state }}'" diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-tmpfs.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-tmpfs.yml index 290c9814c..9a1588b7a 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-tmpfs.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-tmpfs.yml @@ -4,8 +4,8 @@ - name: Check the size of tmpfs ansible.builtin.command: awk '/\/dev\/shm/&&/tmpfs/{gsub ("defaults,size=", "", $4); print $4}' /etc/fstab register: __sap_general_preconfigure_register_fstab_tmpfs_size_gb_assert - ignore_errors: yes - changed_when: no + ignore_errors: true + changed_when: false - name: Assert that there is an entry for tmpfs in /etc/fstab ansible.builtin.assert: @@ -26,8 +26,8 @@ - name: Check if /dev/shm is available and has the expected size ansible.builtin.shell: df -kl /dev/shm | awk '/\/dev\/shm/&&/tmpfs/{printf ("%.0fG\n", $2/1024/1024)}' register: __sap_general_preconfigure_register_df_shm_assert - ignore_errors: yes - changed_when: no + ignore_errors: true + changed_when: false - name: Assert that the current size of tmpfs is large enough as per df output ansible.builtin.assert: diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-uuidd.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-uuidd.yml index 51e462356..360ef7908 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-uuidd.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-uuidd.yml @@ -20,8 +20,8 @@ - name: Get status of uuidd.socket # noqa command-instead-of-module ansible.builtin.command: systemctl status uuidd.socket register: __sap_general_preconfigure_register_uuidd_socket_status_assert - ignore_errors: yes - changed_when: no + ignore_errors: true + changed_when: false - name: Report uuidd.socket service status ansible.builtin.debug: diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-etc-hosts.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-etc-hosts.yml index 1b517f915..306a8e043 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-etc-hosts.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-etc-hosts.yml @@ -67,7 +67,7 @@ fi register: __sap_general_preconfigure_register_duplicate_ip_check changed_when: false - ignore_errors: yes + ignore_errors: true when: not ansible_check_mode - name: Verify that variable sap_general_preconfigure_domain is set @@ -89,7 +89,7 @@ path: /etc/hosts regexp: '^{{ sap_general_preconfigure_ip }}\s' line: "{{ sap_general_preconfigure_ip }} {{ sap_general_preconfigure_hostname }}.{{ sap_general_preconfigure_domain }} {{ sap_general_preconfigure_hostname }}{{ __sap_general_preconfigure_register_sap_hostname_aliases.stdout }}" - backup: yes + backup: true when: - not ansible_check_mode - sap_general_preconfigure_domain | length > 0 diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-firewall.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-firewall.yml index 643b39689..3f31c1ff8 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-firewall.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-firewall.yml @@ -5,5 +5,5 @@ ansible.builtin.systemd: name: firewalld state: stopped - enabled: no + enabled: false when: "'firewalld' in ansible_facts.packages" diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-kernel-parameters.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-kernel-parameters.yml index f498cdce8..449899606 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-kernel-parameters.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-kernel-parameters.yml @@ -4,7 +4,7 @@ - name: Set kernel parameters ansible.builtin.lineinfile: path: "{{ sap_general_preconfigure_etc_sysctl_sap_conf }}" - create: yes + create: true mode: '0644' regexp: ^{{ line_item.name }}.* line: "{{ line_item.name }}={{ line_item.value }}" diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml index d39c1883e..595a40671 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml @@ -54,7 +54,7 @@ - name: SELinux - Examine grub entries ansible.builtin.shell: set -o pipefail && grubby --info=ALL | awk 'BEGIN{a=0;b=0}/^args/{a++}/selinux=0/{b++}END{print a, b}' register: __sap_general_preconfigure_register_grubby_info_all_selinux - check_mode: no + check_mode: false changed_when: false - name: Disable SELinux on the kernel command line, RHEL 8 and RHEL 9 @@ -70,7 +70,7 @@ - name: Disable SELinux also on the kernel command line, RHEL 8 and RHEL 9 ansible.builtin.command: grubby --args="selinux=0" --update-kernel=ALL notify: __sap_general_preconfigure_reboot_handler - changed_when: yes + changed_when: true # Reason for noqa: We need to notify a handler in another role, which is not possible from a handler in the current role - name: SELinux, disable on the kernel command line - Set the flag that reboot is needed to apply changes # noqa no-handler @@ -89,7 +89,7 @@ - name: Make sure SELinux is not disabled on the kernel command line, RHEL 8 and RHEL 9 ansible.builtin.command: grubby --remove-args="selinux" --update-kernel=ALL notify: __sap_general_preconfigure_reboot_handler - changed_when: yes + changed_when: true # Reason for noqa: We need to notify a handler in another role, which is not possible from a handler in the current role - name: SELinux, enable on the kernel command line - Set the flag that reboot is needed to apply changes # noqa no-handler diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-systemd-tmpfiles.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-systemd-tmpfiles.yml index 750d1e962..4d12fa3b2 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-systemd-tmpfiles.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-systemd-tmpfiles.yml @@ -8,7 +8,7 @@ owner: root group: root mode: '0644' - backup: yes + backup: true when: ansible_distribution_major_version != '9' - name: Copy file /etc/tmpfiles.d/sap.conf, RHEL 9 @@ -18,5 +18,5 @@ owner: root group: root mode: '0644' - backup: yes + backup: true when: ansible_distribution_major_version == '9' diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-tmpfs.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-tmpfs.yml index 1f7197b13..78fa3d264 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-tmpfs.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-tmpfs.yml @@ -14,9 +14,9 @@ - name: Get the current size of /dev/shm ansible.builtin.shell: df -hl /dev/shm | awk '/\/dev\/shm/&&/tmpfs/{gsub ("G", ""); print $2}' register: __sap_general_preconfigure_register_df_shm - ignore_errors: yes - changed_when: no - check_mode: no + ignore_errors: true + changed_when: false + check_mode: false - name: Trigger remounting if /dev/shm has not the expected size ansible.builtin.command: /bin/true diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-uuidd.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-uuidd.yml index 4e3e6cf70..8e1450176 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-uuidd.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-uuidd.yml @@ -4,11 +4,11 @@ - name: Enable and start service uuidd ansible.builtin.systemd: name: uuidd - enabled: yes + enabled: true state: started - name: Enable and start service uuidd.socket ansible.builtin.systemd: name: uuidd.socket - enabled: yes + enabled: true state: started diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/increase-nofile-limits.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/increase-nofile-limits.yml index 350d64056..c83e1652c 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/increase-nofile-limits.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/increase-nofile-limits.yml @@ -8,7 +8,7 @@ for group 'sapsys' # noqa no-tabs ansible.builtin.lineinfile: path: /etc/security/limits.d/99-sap.conf - create: yes + create: true mode: "0644" regexp: '^@sapsys\s+{{ line_item }}\s+nofile\s.*' line: "@sapsys\t{{ line_item }}\tnofile\t1048576" @@ -25,7 +25,7 @@ for group '{{ sap_general_preconfigure_db_group_name }}' # noqa no-tabs ansible.builtin.lineinfile: path: /etc/security/limits.d/99-sap.conf - create: yes + create: true mode: "0644" regexp: '^@{{ sap_general_preconfigure_db_group_name }}\s+{{ line_item }}\s+nofile\s.*' line: "@{{ sap_general_preconfigure_db_group_name }}\t{{ line_item }}\tnofile\t1048576" diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/increase-nproc-limits.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/increase-nproc-limits.yml index fa62cd8c7..85ec1e900 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/increase-nproc-limits.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/increase-nproc-limits.yml @@ -8,7 +8,7 @@ for group 'sapsys' # noqa no-tabs ansible.builtin.lineinfile: path: /etc/security/limits.d/99-sap.conf - create: yes + create: true mode: "0644" regexp: '^@sapsys\s+{{ line_item }}\s+nproc\s.*' line: "@sapsys\t{{ line_item }}\tnproc\tunlimited" @@ -25,7 +25,7 @@ for group '{{ sap_general_preconfigure_db_group_name }}' # noqa no-tabs ansible.builtin.lineinfile: path: /etc/security/limits.d/99-sap.conf - create: yes + create: true mode: "0644" regexp: '^@{{ sap_general_preconfigure_db_group_name }}\s+{{ line_item }}\s+nproc\s.*' line: "@{{ sap_general_preconfigure_db_group_name }}\t{{ line_item }}\tnproc\tunlimited" diff --git a/roles/sap_general_preconfigure/tasks/RedHat/installation.yml b/roles/sap_general_preconfigure/tasks/RedHat/installation.yml index 73bc2f490..2e39f2fea 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/installation.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/installation.yml @@ -208,9 +208,9 @@ with_list: "{{ __sap_general_preconfigure_min_pkgs }}" loop_control: loop_var: pkg - check_mode: no + check_mode: false register: __sap_general_preconfigure_register_minpkglist - changed_when: no + changed_when: false - name: Display the content of the minimum package list variable ansible.builtin.debug: diff --git a/roles/sap_general_preconfigure/tasks/SLES/assert-installation.yml b/roles/sap_general_preconfigure/tasks/SLES/assert-installation.yml index ecf4468e5..6aa787615 100644 --- a/roles/sap_general_preconfigure/tasks/SLES/assert-installation.yml +++ b/roles/sap_general_preconfigure/tasks/SLES/assert-installation.yml @@ -58,9 +58,9 @@ with_list: "{{ __sap_general_preconfigure_min_pkgs }}" loop_control: loop_var: pkg - check_mode: no + check_mode: false register: __sap_general_preconfigure_register_minpkglist_assert - changed_when: no + changed_when: false - name: Assert that minimum required package versions are installed # If the output includes the string "is already installed" (case 2b), we have a PASS. Otherwise, it's a FAIL. @@ -72,12 +72,12 @@ loop_control: loop_var: line_item label: "" - ignore_errors: yes + ignore_errors: true - name: Report if no minimum required package version is defined for this RHEL release ansible.builtin.debug: msg: "INFO: No minimum required package version defined (variable __sap_general_preconfigure_min_pkgs)." - ignore_errors: yes + ignore_errors: true when: not __sap_general_preconfigure_min_pkgs | d([]) # Reason for noqa: The yum module appears to not support the check-update option @@ -99,7 +99,7 @@ - name: Report if checking for possible package updates is not requested ansible.builtin.debug: msg: "INFO: Not checking for possible package updates (variable sap_general_preconfigure_update)." - ignore_errors: yes + ignore_errors: true when: not sap_general_preconfigure_update - name: "Assert - Set needs-restarting command in case of RHEL 7" diff --git a/roles/sap_general_preconfigure/tasks/SLES/installation.yml b/roles/sap_general_preconfigure/tasks/SLES/installation.yml index 047d2337c..4f9daed97 100644 --- a/roles/sap_general_preconfigure/tasks/SLES/installation.yml +++ b/roles/sap_general_preconfigure/tasks/SLES/installation.yml @@ -49,9 +49,9 @@ with_list: "{{ __sap_general_preconfigure_min_pkgs }}" loop_control: loop_var: pkg - check_mode: no + check_mode: false register: __sap_general_preconfigure_register_minpkglist - changed_when: no + changed_when: false - name: Display the content of the minimum package list variable ansible.builtin.debug: diff --git a/roles/sap_general_preconfigure/tasks/main.yml b/roles/sap_general_preconfigure/tasks/main.yml index 5682a761f..0cdd514c2 100644 --- a/roles/sap_general_preconfigure/tasks/main.yml +++ b/roles/sap_general_preconfigure/tasks/main.yml @@ -7,15 +7,38 @@ tags: - always +# Example of files loading order: +# 1. Suse.yml / RedHat.yml - Specific to OS family. +# 2. SLES_15.yml / RedHat_9.yml - Specific to distribution (SLES, SLES_SAP or RedHat) and major release. +# 3. SLES_15.6.yml / RedHat_9.2 - Specific to distribution (SLES, SLES_SAP or RedHat) and minor release. +# 4. SLES_SAP_15.yml - Specific to distribution SLES_SAP and major release. +# 5. SLES_SAP_15.6.yml - Specific to distribution SLES_SAP and minor release. - name: Include OS specific vars, specific - ansible.builtin.include_vars: '{{ item }}' - with_first_found: - - '{{ ansible_distribution.split("_")[0] }}_{{ ansible_distribution_version }}.yml' - - '{{ ansible_distribution.split("_")[0] }}_{{ ansible_distribution_major_version }}.yml' - - '{{ ansible_os_family }}.yml' + ansible.builtin.include_vars: "{{ __vars_file }}" + loop: "{{ __var_files }}" + vars: + __vars_file: "{{ role_path }}/vars/{{ item }}" + __distribution_major: "{{ ansible_distribution ~ '_' ~ ansible_distribution_major_version }}" + __distribution_minor: "{{ ansible_distribution ~ '_' ~ ansible_distribution_version }}" + # Enables loading of shared vars between SLES and SLES_SAP + __distribution_major_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_major_version }}" + __distribution_minor_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_version }}" + __var_files: >- + {{ + [ + ansible_os_family ~ '.yml', + (ansible_distribution ~ '.yml') if ansible_distribution != ansible_os_family else None, + (__distribution_major_split ~ '.yml') if __distribution_major_split != __distribution_major else None, + (__distribution_minor_split ~ '.yml') if __distribution_minor_split != __distribution_minor else None, + __distribution_major ~ '.yml', + __distribution_minor ~ '.yml' + ] | select('defined') | select('string') | list + }} + when: __vars_file is file tags: - always + - name: Rename user sap_preconfigure variables if found, generic ansible.builtin.set_fact: sap_general_preconfigure_config_all: "{{ (sap_preconfigure_config_all | d(sap_general_preconfigure_config_all)) | d(true) }}" diff --git a/roles/sap_general_preconfigure/tasks/sapnote/2002167/03-setting-the-hostname.yml b/roles/sap_general_preconfigure/tasks/sapnote/2002167/03-setting-the-hostname.yml index 9e96a2657..bf642b1ac 100644 --- a/roles/sap_general_preconfigure/tasks/sapnote/2002167/03-setting-the-hostname.yml +++ b/roles/sap_general_preconfigure/tasks/sapnote/2002167/03-setting-the-hostname.yml @@ -16,7 +16,7 @@ - name: Import role sap_maintain_etc_hosts ansible.builtin.import_role: - name: 'community.sap_install.sap_maintain_etc_hosts' + name: '{{ sap_general_preconfigure_sap_install_collection }}.sap_maintain_etc_hosts' vars: sap_maintain_etc_hosts_list: - node_ip: "{{ sap_general_preconfigure_ip }}" diff --git a/roles/sap_general_preconfigure/tasks/sapnote/2369910.yml b/roles/sap_general_preconfigure/tasks/sapnote/2369910.yml new file mode 100644 index 000000000..20de2aa0d --- /dev/null +++ b/roles/sap_general_preconfigure/tasks/sapnote/2369910.yml @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: Apache-2.0 +--- +- name: Configure - Display SAP note number 2369910 and its version + ansible.builtin.debug: + msg: "SAP note {{ (__sap_general_preconfigure_sapnotes_versions | selectattr('number', 'match', '^2369910$') | first).number }} + (version {{ (__sap_general_preconfigure_sapnotes_versions | selectattr('number', 'match', '^2369910$') | first).version }}): SAP Software on Linux: General Information" + tags: + - always + +- name: Check locales + when: sap_general_preconfigure_config_all | d(true) or sap_general_preconfigure_2369910 | d(false) + tags: + - sap_general_preconfigure_2369910 + - sap_general_preconfigure_configure_locale + block: + - name: Configure an English locale + when: + - sap_general_preconfigure_default_locale is defined and sap_general_preconfigure_default_locale + - sap_general_preconfigure_default_locale == 'C.UTF-8' or + sap_general_preconfigure_default_locale == 'C.utf8' or + sap_general_preconfigure_default_locale.startswith('en_') and + (sap_general_preconfigure_default_locale.endswith('UTF-8') or + sap_general_preconfigure_default_locale.endswith('utf8')) + ansible.builtin.command: "localectl set-locale LANG={{ sap_general_preconfigure_default_locale }}" + changed_when: true + + - name: Get the current default locale + ansible.builtin.command: awk '{gsub("\"","")}/^LANG=/&&(/=C\./||/=en_/)&&(/utf8$/||/UTF-8$/){print}' /etc/locale.conf + changed_when: false + register: __sap_general_preconfigure_current_default_locale + + - name: Assert that an English locale is the default + ansible.builtin.assert: + that: __sap_general_preconfigure_current_default_locale.stdout_lines | length > 0 + fail_msg: > + "FAIL: English is not set as the default locale. Please define an English default locale + with the 'sap_general_preconfigure_default_locale' variable!" + success_msg: "PASS: An English default locale is set." diff --git a/roles/sap_general_preconfigure/tasks/sapnote/2772999/03-configure-hostname.yml b/roles/sap_general_preconfigure/tasks/sapnote/2772999/03-configure-hostname.yml index 1a22f7c6b..3f04c4e21 100644 --- a/roles/sap_general_preconfigure/tasks/sapnote/2772999/03-configure-hostname.yml +++ b/roles/sap_general_preconfigure/tasks/sapnote/2772999/03-configure-hostname.yml @@ -16,7 +16,7 @@ - name: Import role sap_maintain_etc_hosts ansible.builtin.import_role: - name: 'community.sap_install.sap_maintain_etc_hosts' + name: '{{ sap_general_preconfigure_sap_install_collection }}.sap_maintain_etc_hosts' vars: sap_maintain_etc_hosts_list: - node_ip: "{{ sap_general_preconfigure_ip }}" diff --git a/roles/sap_general_preconfigure/tasks/sapnote/2772999/04-assert-network-time-and-date.yml b/roles/sap_general_preconfigure/tasks/sapnote/2772999/04-assert-network-time-and-date.yml index b23b7ca93..ba3ebe2ae 100644 --- a/roles/sap_general_preconfigure/tasks/sapnote/2772999/04-assert-network-time-and-date.yml +++ b/roles/sap_general_preconfigure/tasks/sapnote/2772999/04-assert-network-time-and-date.yml @@ -11,8 +11,8 @@ - name: Get status of chronyd # noqa command-instead-of-module ansible.builtin.command: systemctl status chronyd register: __sap_general_preconfigure_register_chronyd_status_assert - ignore_errors: yes - changed_when: no + ignore_errors: true + changed_when: false tags: - sap_general_preconfigure_network_time_and_date diff --git a/roles/sap_general_preconfigure/tasks/sapnote/2772999/04-configure-network-time-and-date.yml b/roles/sap_general_preconfigure/tasks/sapnote/2772999/04-configure-network-time-and-date.yml index e796f0e47..3e92e9a63 100644 --- a/roles/sap_general_preconfigure/tasks/sapnote/2772999/04-configure-network-time-and-date.yml +++ b/roles/sap_general_preconfigure/tasks/sapnote/2772999/04-configure-network-time-and-date.yml @@ -11,6 +11,6 @@ ansible.builtin.systemd: name: chronyd state: started - enabled: yes + enabled: true tags: - sap_general_preconfigure_network_time_and_date diff --git a/roles/sap_general_preconfigure/tasks/sapnote/3108316/03-configure-hostname.yml b/roles/sap_general_preconfigure/tasks/sapnote/3108316/03-configure-hostname.yml index fab19c6b6..15b884b9d 100644 --- a/roles/sap_general_preconfigure/tasks/sapnote/3108316/03-configure-hostname.yml +++ b/roles/sap_general_preconfigure/tasks/sapnote/3108316/03-configure-hostname.yml @@ -16,7 +16,7 @@ - name: Import role sap_maintain_etc_hosts ansible.builtin.import_role: - name: 'community.sap_install.sap_maintain_etc_hosts' + name: '{{ sap_general_preconfigure_sap_install_collection }}.sap_maintain_etc_hosts' vars: sap_maintain_etc_hosts_list: - node_ip: "{{ sap_general_preconfigure_ip }}" diff --git a/roles/sap_general_preconfigure/tasks/sapnote/3108316/04-assert-network-time-and-date.yml b/roles/sap_general_preconfigure/tasks/sapnote/3108316/04-assert-network-time-and-date.yml index 4113c99ea..e87a2d456 100644 --- a/roles/sap_general_preconfigure/tasks/sapnote/3108316/04-assert-network-time-and-date.yml +++ b/roles/sap_general_preconfigure/tasks/sapnote/3108316/04-assert-network-time-and-date.yml @@ -11,8 +11,8 @@ - name: Get status of chronyd # noqa command-instead-of-module ansible.builtin.command: systemctl status chronyd register: __sap_general_preconfigure_register_chronyd_status_assert - ignore_errors: yes - changed_when: no + ignore_errors: true + changed_when: false tags: - sap_general_preconfigure_network_time_and_date diff --git a/roles/sap_general_preconfigure/tasks/sapnote/3108316/04-configure-network-time-and-date.yml b/roles/sap_general_preconfigure/tasks/sapnote/3108316/04-configure-network-time-and-date.yml index 7bfb16d8b..d369d843d 100644 --- a/roles/sap_general_preconfigure/tasks/sapnote/3108316/04-configure-network-time-and-date.yml +++ b/roles/sap_general_preconfigure/tasks/sapnote/3108316/04-configure-network-time-and-date.yml @@ -11,6 +11,6 @@ ansible.builtin.systemd: name: chronyd state: started - enabled: yes + enabled: true tags: - sap_general_preconfigure_network_time_and_date diff --git a/roles/sap_general_preconfigure/tasks/sapnote/assert-2369910.yml b/roles/sap_general_preconfigure/tasks/sapnote/assert-2369910.yml new file mode 100644 index 000000000..e14f88ebb --- /dev/null +++ b/roles/sap_general_preconfigure/tasks/sapnote/assert-2369910.yml @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: Apache-2.0 +--- +- name: Assert - Display SAP note number 2369910 and its version + ansible.builtin.debug: + msg: "SAP note {{ (__sap_general_preconfigure_sapnotes_versions | selectattr('number', 'match', '^2369910$') | first).number }} + (version {{ (__sap_general_preconfigure_sapnotes_versions | selectattr('number', 'match', '^2369910$') | first).version }}): SAP Software on Linux: General Information" + tags: + - always + +## STEP 3.1 -- System Language +- name: Step 3.1 - Check if English Language is installed + tags: + - sap_general_preconfigure_2369910 + - sap_general_preconfigure_2369910_03 + block: + - name: Get list of installed locales + ansible.builtin.command: locale -a + changed_when: false + register: __sap_general_preconfigure_locales_installed + + - name: Assert that an English locale is installed + ansible.builtin.assert: + that: __sap_general_preconfigure_locales_installed.stdout_lines | select('match', '^en_') | list | length > 0 + fail_msg: "FAIL: No English locale is installed. Please install an English locale!" + success_msg: "PASS: An English locale is installed." + + - name: Get the current default locale + ansible.builtin.command: awk '{gsub("\"","")}/^LANG=/&&(/=C\./||/=en_/)&&(/utf8$/||/UTF-8$/){print}' /etc/locale.conf + changed_when: false + register: __sap_general_preconfigure_current_default_locale + + - name: Assert that an English locale is the default + ansible.builtin.assert: + that: __sap_general_preconfigure_current_default_locale.stdout_lines | length > 0 + fail_msg: "FAIL: English is not set as the default locale. Please define a valid English default locale with the variable 'sap_general_preconfigure_default_locale' !" + success_msg: "PASS: An English default locale is set." diff --git a/roles/sap_general_preconfigure/vars/RedHat_7.yml b/roles/sap_general_preconfigure/vars/RedHat_7.yml index 76f8dc464..8d59e235c 100644 --- a/roles/sap_general_preconfigure/vars/RedHat_7.yml +++ b/roles/sap_general_preconfigure/vars/RedHat_7.yml @@ -4,6 +4,7 @@ # vars file for sap_general_preconfigure __sap_general_preconfigure_sapnotes_versions: + - { number: '2369910', version: '18' } - { number: '2002167', version: '36' } - { number: '1771258', version: '6' } - { number: '1391070', version: '41' } @@ -93,6 +94,9 @@ __sap_general_preconfigure_packages_x86_64: - compat-sap-c++-7 - compat-sap-c++-9 - compat-sap-c++-10 +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages_ppc64le: - uuidd @@ -103,17 +107,26 @@ __sap_general_preconfigure_packages_ppc64le: - compat-sap-c++-7 - compat-sap-c++-9 - compat-sap-c++-10 +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages_ppc64: - uuidd - tcsh - psmisc - compat-sap-c++-5 +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages_s390x: - uuidd - tcsh - psmisc +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages: "{{ lookup('vars', '__sap_general_preconfigure_packages_' + ansible_architecture) }}" diff --git a/roles/sap_general_preconfigure/vars/RedHat_8.0.yml b/roles/sap_general_preconfigure/vars/RedHat_8.0.yml index 0f952dcd1..d0f8fe031 100644 --- a/roles/sap_general_preconfigure/vars/RedHat_8.0.yml +++ b/roles/sap_general_preconfigure/vars/RedHat_8.0.yml @@ -4,6 +4,7 @@ # vars file for sap_general_preconfigure __sap_general_preconfigure_sapnotes_versions: + - { number: '2369910', version: '18' } - { number: '2772999', version: '24' } - { number: '1771258', version: '6' } @@ -47,6 +48,9 @@ __sap_general_preconfigure_packages: - psmisc - nfs-utils - bind-utils +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_required_ppc64le: - ibm-power-managed-rhel8 diff --git a/roles/sap_general_preconfigure/vars/RedHat_8.1.yml b/roles/sap_general_preconfigure/vars/RedHat_8.1.yml index 3ffd289a8..375b7e05f 100644 --- a/roles/sap_general_preconfigure/vars/RedHat_8.1.yml +++ b/roles/sap_general_preconfigure/vars/RedHat_8.1.yml @@ -4,6 +4,7 @@ # vars file for sap_general_preconfigure __sap_general_preconfigure_sapnotes_versions: + - { number: '2369910', version: '18' } - { number: '2772999', version: '24' } - { number: '1771258', version: '6' } @@ -49,6 +50,9 @@ __sap_general_preconfigure_packages_x86_64: - bind-utils - compat-sap-c++-9 - compat-sap-c++-10 +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages_ppc64le: - uuidd @@ -59,6 +63,9 @@ __sap_general_preconfigure_packages_ppc64le: - bind-utils - compat-sap-c++-9 - compat-sap-c++-10 +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages_s390x: - uuidd @@ -67,6 +74,9 @@ __sap_general_preconfigure_packages_s390x: - psmisc - nfs-utils - bind-utils +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages: "{{ lookup('vars', '__sap_general_preconfigure_packages_' + ansible_architecture) }}" diff --git a/roles/sap_general_preconfigure/vars/RedHat_8.2.yml b/roles/sap_general_preconfigure/vars/RedHat_8.2.yml index e47d88065..bd26d320e 100644 --- a/roles/sap_general_preconfigure/vars/RedHat_8.2.yml +++ b/roles/sap_general_preconfigure/vars/RedHat_8.2.yml @@ -4,6 +4,7 @@ # vars file for sap_general_preconfigure __sap_general_preconfigure_sapnotes_versions: + - { number: '2369910', version: '18' } - { number: '2772999', version: '24' } - { number: '1771258', version: '6' } @@ -49,6 +50,9 @@ __sap_general_preconfigure_packages_x86_64: - bind-utils - compat-sap-c++-9 - compat-sap-c++-10 +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages_ppc64le: - uuidd @@ -59,6 +63,9 @@ __sap_general_preconfigure_packages_ppc64le: - bind-utils - compat-sap-c++-9 - compat-sap-c++-10 +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages_s390x: - uuidd @@ -67,6 +74,9 @@ __sap_general_preconfigure_packages_s390x: - psmisc - nfs-utils - bind-utils +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages: "{{ lookup('vars', '__sap_general_preconfigure_packages_' + ansible_architecture) }}" diff --git a/roles/sap_general_preconfigure/vars/RedHat_8.yml b/roles/sap_general_preconfigure/vars/RedHat_8.yml index aa05e96dd..12ee9598d 100644 --- a/roles/sap_general_preconfigure/vars/RedHat_8.yml +++ b/roles/sap_general_preconfigure/vars/RedHat_8.yml @@ -4,6 +4,7 @@ # vars file for sap_general_preconfigure __sap_general_preconfigure_sapnotes_versions: + - { number: '2369910', version: '18' } - { number: '2772999', version: '24' } - { number: '1771258', version: '6' } @@ -59,6 +60,9 @@ __sap_general_preconfigure_packages_x86_64: - compat-sap-c++-9 - compat-sap-c++-10 - compat-sap-c++-11 +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages_ppc64le: - uuidd @@ -70,6 +74,9 @@ __sap_general_preconfigure_packages_ppc64le: - compat-sap-c++-9 - compat-sap-c++-10 - compat-sap-c++-11 +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages_s390x: - uuidd @@ -79,6 +86,9 @@ __sap_general_preconfigure_packages_s390x: - nfs-utils - bind-utils - compat-sap-c++-10 +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages: "{{ lookup('vars', '__sap_general_preconfigure_packages_' + ansible_architecture) }}" diff --git a/roles/sap_general_preconfigure/vars/RedHat_9.yml b/roles/sap_general_preconfigure/vars/RedHat_9.yml index 9f22fefe0..a25793787 100644 --- a/roles/sap_general_preconfigure/vars/RedHat_9.yml +++ b/roles/sap_general_preconfigure/vars/RedHat_9.yml @@ -4,6 +4,7 @@ # vars file for sap_general_preconfigure __sap_general_preconfigure_sapnotes_versions: + - { number: '2369910', version: '18' } - { number: '3108316', version: '2' } - { number: '1771258', version: '6' } @@ -65,6 +66,9 @@ __sap_general_preconfigure_packages_x86_64: - tuned # package libxcrypt-compat: needed by sapstartsrv and SAP HANA on RHEL 9: - libxcrypt-compat +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages_ppc64le: - uuidd @@ -79,6 +83,9 @@ __sap_general_preconfigure_packages_ppc64le: - tuned # package libxcrypt-compat: needed by sapstartsrv and SAP HANA on RHEL 9: - libxcrypt-compat +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages_s390x: - uuidd @@ -93,6 +100,9 @@ __sap_general_preconfigure_packages_s390x: - tuned # package libxcrypt-compat: needed by sapstartsrv on RHEL 9: - libxcrypt-compat +# English locale packages are required as per SAP note 2369910: + - langpacks-en + - glibc-langpack-en __sap_general_preconfigure_packages: "{{ lookup('vars', '__sap_general_preconfigure_packages_' + ansible_architecture) }}" diff --git a/roles/sap_general_preconfigure/vars/SLES_15.yml b/roles/sap_general_preconfigure/vars/Suse.yml similarity index 57% rename from roles/sap_general_preconfigure/vars/SLES_15.yml rename to roles/sap_general_preconfigure/vars/Suse.yml index b6b7f7bf0..f43013ded 100644 --- a/roles/sap_general_preconfigure/vars/SLES_15.yml +++ b/roles/sap_general_preconfigure/vars/Suse.yml @@ -1,7 +1,13 @@ # SPDX-License-Identifier: Apache-2.0 --- +# Variables specific to following versions: +# - SUSE Linux Enterprise Server for SAP Applications 15 +# - SUSE Linux Enterprise Server 15 +# - SUSE Linux Enterprise Server for SAP Applications 16 +# - SUSE Linux Enterprise Server 16 + __sap_general_preconfigure_sapnotes_versions: - - '' + - { number: '2369910', version: '18' } __sap_general_preconfigure_packages: - uuidd @@ -9,7 +15,6 @@ __sap_general_preconfigure_packages: - psmisc - nfs-utils - bind-utils -# package hostname: needed by rhel-system-roles-sap - hostname __sap_general_preconfigure_min_pkgs: diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index a74280e49..c85964e20 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -883,7 +883,8 @@ sap_ha_pacemaker_cluster_resource_defaults: - _Type:_ `string`
- _Default:_ `True`
-Disabling this variable enables to use Classic SAPHanaSR agents even on server, with SAPHanaSR-angi is available.
+Disabling this variable enables to use Classic SAPHanaSR agents even on server, where SAPHanaSR-angi is available.
+Value `false` (Classic) is ignored when only SAPHanaSR-angi packages are available.
### sap_ha_pacemaker_cluster_sbd_devices - _Type:_ `list`
diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 7947b0afe..b50453b94 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -113,7 +113,7 @@ sap_ha_pacemaker_cluster_hana_resource_name: '' # Default: rsc_SAPHa sap_ha_pacemaker_cluster_hana_resource_clone_name: '' # Default: cln_SAPHana__HDB sap_ha_pacemaker_cluster_hana_resource_clone_msl_name: '' # Default: msl_SAPHana__HDB sap_ha_pacemaker_cluster_hanacontroller_resource_name: '' # Default: rsc_SAPHanaCon__HDB -sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name: '' # Default: cln_SAPHanaCon__HDB +sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name: '' # Default: _SAPHanaCon__HDB sap_ha_pacemaker_cluster_hana_topology_resource_name: '' # Default: rsc_SAPHanaTop__HDB sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: '' # Default: cln_SAPHanaTop__HDB sap_ha_pacemaker_cluster_hana_filesystem_resource_name: '' # Default: rsc_SAPHanaFil__HDB diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 0c55ad7b3..8f699c35d 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -427,7 +427,7 @@ argument_specs: - Customize the cluster resource name of the SAP HANA Controller. sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name: - default: "cln_SAPHanaCon__HDB" + default: "_SAPHanaCon__HDB" description: - Customize the cluster resource name of the SAP HANA Controller clone. @@ -558,7 +558,8 @@ argument_specs: default: true description: - Disabling this variable enables to use Classic SAPHanaSR agents even on server, - with SAPHanaSR-angi is available. + where SAPHanaSR-angi is available. + - Value `false` (Classic) is ignored when only SAPHanaSR-angi packages are available. ########################################################################## # NetWeaver specific parameters diff --git a/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_hana.yml b/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_hana.yml index f4b0dd297..52aeff021 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_hana.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_hana.yml @@ -1,7 +1,51 @@ # SPDX-License-Identifier: Apache-2.0 --- -# Identify if SAPHanaSR-angi package is available for installation. -# SAPHanaSR-angi replaces SAPHanaSR and SAPHanaSR-ScaleOut. +# Identify if 'sap-hana-ha' package is available for installation. +# sap-hana-ha replaces resource-agents-sap-hana and resource-agents-sap-hana-scaleout. -# TODO: -# Add RedHat specific steps to identify SAPHanaSR-angi package. +- name: "SAP HA Prepare Pacemaker - Block for detection of 'SAPHanaSR-angi'" + when: (sap_ha_pacemaker_cluster_saphanasr_angi_detection | bool) + block: + + - name: "SAP HA Prepare Pacemaker - Gather installed packages facts" + ansible.builtin.package_facts: + manager: auto + + - name: "SAP HA Prepare Pacemaker - Check the availability of 'sap-hana-ha'" + ansible.builtin.command: + cmd: dnf provides sap-hana-ha + changed_when: false + register: __sap_ha_pacemaker_cluster_saphanasr_angi_check + failed_when: false + + # The provision role should not fix packages if run against systems that + # were previously installed with the conflicting packages. System state is + # unclear at this moment and the role should rather fail early. + - name: "SAP HA Prepare Pacemaker - Fail if there are package conflicts" + ansible.builtin.assert: + that: + - "'resource-agents-sap-hana' not in packages or + __sap_ha_pacemaker_cluster_saphanasr_angi_check.rc == 0" + fail_msg: | + + ERROR: Conflicting packages. + + Package available and to be installed: sap-hana-ha + + Conflicting packages are installed: + {% for finding in (packages | select('match', 'resource-agents-sap.*')) %} + - {{ finding }} + {% endfor %} + + Remove the conflicting packages to continue the setup with the + detected resource agent package. + Alternatively: Disable the package detection + (sap_ha_pacemaker_cluster_saphanasr_angi_detection = false) + to continue the setup using the installed resource agents. + + - name: "SAP HA Prepare Pacemaker - Set fact angi_available" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_saphanasr_angi_available: true + when: + - __sap_ha_pacemaker_cluster_saphanasr_angi_check is defined + - __sap_ha_pacemaker_cluster_saphanasr_angi_check.rc == 0 diff --git a/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_nwas_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_nwas_ascs_ers.yml new file mode 100644 index 000000000..cd8cab36d --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/RedHat/pre_steps_nwas_ascs_ers.yml @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: Apache-2.0 +--- +# Identify the version of the resource agents and disable +# the use of "SimpleMount" if a minimum version is not satisfied. + +- name: "SAP HA Prepare Pacemaker - Block for detection of 'SAPStartSrv' availability" + block: + + - name: "SAP HA Prepare Pacemaker - Check the resource agents package" + ansible.builtin.shell: + set -o pipefail && \ + dnf info resource-agents-sap | awk '/^Version/ {print $3}' | sort | tail -n1 + register: __sap_ha_pacemaker_cluster_sapstartsrv_check + changed_when: false + failed_when: false + + - name: "SAP HA Prepare Pacemaker - Disable Simple Mount when min. package version is not available" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount: false + when: + - sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount | bool + - __sap_ha_pacemaker_cluster_sapstartsrv_check.stdout is defined + - "(__sap_ha_pacemaker_cluster_sapstartsrv_check.stdout) is version(__sap_ha_pacemaker_cluster_nwas_simple_mount_version, '<')" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/Suse/post_steps_nwas_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/Suse/post_steps_nwas_abap_ascs_ers.yml index 2d5c7d733..d1e876f99 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/Suse/post_steps_nwas_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/Suse/post_steps_nwas_abap_ascs_ers.yml @@ -7,19 +7,6 @@ # Following steps are similar to crmsh code in ha_cluster role, but they are # too SAP specific, so they are added here instead of there. -# Python3-pip and pexpect are required for ansible.builtin.expect -# Python installation was removed from sap_swpm role in PR#720 -- name: "SAP HA Install Pacemaker - Install required python3-pip" - ansible.builtin.package: - name: - - python3-pip - state: present - -- name: "SAP HA Install Pacemaker - Install required pip pexpect" - ansible.builtin.pip: - name: - - pexpect - - name: Block to ensure that changes are executed only once run_once: true # noqa: run_once[task] block: @@ -31,11 +18,8 @@ register: __sap_ha_pacemaker_cluster_cib_xml_backup - name: "SAP HA Install Pacemaker - Put cluster in maintenance mode" - ansible.builtin.expect: - command: crm configure property maintenance-mode=true - responses: - ".*is-managed.*": "n" - ".*already.*": "n" + ansible.builtin.command: + cmd: crm --force configure property maintenance-mode=true check_mode: false changed_when: true @@ -88,10 +72,7 @@ changed_when: true - name: "SAP HA Install Pacemaker - Disable maintenance mode" - ansible.builtin.expect: - command: crm configure property maintenance-mode=false - responses: - ".*is-managed.*": "n" - ".*already.*": "n" + ansible.builtin.command: + cmd: crm --force configure property maintenance-mode=false check_mode: false changed_when: true diff --git a/roles/sap_ha_pacemaker_cluster/tasks/Suse/post_steps_nwas_java_scs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/Suse/post_steps_nwas_java_scs_ers.yml index 2d5c7d733..d1e876f99 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/Suse/post_steps_nwas_java_scs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/Suse/post_steps_nwas_java_scs_ers.yml @@ -7,19 +7,6 @@ # Following steps are similar to crmsh code in ha_cluster role, but they are # too SAP specific, so they are added here instead of there. -# Python3-pip and pexpect are required for ansible.builtin.expect -# Python installation was removed from sap_swpm role in PR#720 -- name: "SAP HA Install Pacemaker - Install required python3-pip" - ansible.builtin.package: - name: - - python3-pip - state: present - -- name: "SAP HA Install Pacemaker - Install required pip pexpect" - ansible.builtin.pip: - name: - - pexpect - - name: Block to ensure that changes are executed only once run_once: true # noqa: run_once[task] block: @@ -31,11 +18,8 @@ register: __sap_ha_pacemaker_cluster_cib_xml_backup - name: "SAP HA Install Pacemaker - Put cluster in maintenance mode" - ansible.builtin.expect: - command: crm configure property maintenance-mode=true - responses: - ".*is-managed.*": "n" - ".*already.*": "n" + ansible.builtin.command: + cmd: crm --force configure property maintenance-mode=true check_mode: false changed_when: true @@ -88,10 +72,7 @@ changed_when: true - name: "SAP HA Install Pacemaker - Disable maintenance mode" - ansible.builtin.expect: - command: crm configure property maintenance-mode=false - responses: - ".*is-managed.*": "n" - ".*already.*": "n" + ansible.builtin.command: + cmd: crm --force configure property maintenance-mode=false check_mode: false changed_when: true diff --git a/roles/sap_ha_pacemaker_cluster/tasks/Suse/pre_steps_hana.yml b/roles/sap_ha_pacemaker_cluster/tasks/Suse/pre_steps_hana.yml index 6f6d031e2..3e2d2f04b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/Suse/pre_steps_hana.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/Suse/pre_steps_hana.yml @@ -6,7 +6,8 @@ # This is destructive step if executed on running cluster # without proper migration from SAPHanaSR to SAPHanaSR-angi! -- name: "SAP HA Prepare Pacemaker - Block for detection of SAPHanaSR-angi" + +- name: "SAP HA Prepare Pacemaker - Block for preparation of SAPHanaSR-angi HANA cluster" when: (sap_ha_pacemaker_cluster_saphanasr_angi_detection | bool) block: # Requirement for package_facts Ansible Module @@ -27,6 +28,8 @@ register: __sap_ha_pacemaker_cluster_zypper_angi_check failed_when: false + + # Uninstall SAPHanaSR package on SLES 15 # package can be replaced with "rpm -e --nodeps {{ item }}" - name: "SAP HA Prepare Pacemaker - Remove SAPHanaSR and SAPHanaSR-doc" ansible.builtin.package: @@ -39,6 +42,8 @@ - __sap_ha_pacemaker_cluster_zypper_angi_check is defined - __sap_ha_pacemaker_cluster_zypper_angi_check.rc == 0 - "'SAPHanaSR' in ansible_facts.packages" + # SAPHanaSR (Classic) is not available on SLES 16 + - ansible_distribution_major_version | int < 16 - name: "SAP HA Prepare Pacemaker - Set fact angi_available" ansible.builtin.set_fact: @@ -46,3 +51,43 @@ when: - __sap_ha_pacemaker_cluster_zypper_angi_check is defined - __sap_ha_pacemaker_cluster_zypper_angi_check.rc == 0 + + +- name: "SAP HA Prepare Pacemaker - Block for preparation of Classic HANA cluster" + when: + - not (sap_ha_pacemaker_cluster_saphanasr_angi_detection | bool) + # SAPHanaSR (Classic) is not available on SLES 16 + - ansible_distribution_major_version | int < 16 + block: + # Requirement for package_facts Ansible Module + # SLES: Ensure OS Package for Python Lib of rpm bindings is enabled for System Python + - name: "SAP HA Prepare Pacemaker - Ensure python3-rpm package is present" + ansible.builtin.package: + name: python3-rpm + state: present + + - name: "SAP HA Prepare Pacemaker - Gather installed packages facts" + ansible.builtin.package_facts: + manager: auto + + # package can be replaced with "rpm -e --nodeps {{ item }}" + - name: "SAP HA Prepare Pacemaker - Remove SAPHanaSR-angi" + ansible.builtin.package: + name: "{{ item }}" + state: absent + loop: + - SAPHanaSR-angi + when: + - "'SAPHanaSR-angi' in ansible_facts.packages" + + - name: "SAP HA Prepare Pacemaker - Set fact angi_available" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_saphanasr_angi_available: false + + +# Ensure that angi flag is always set for SLES 16 +- name: "SAP HA Prepare Pacemaker - Ensure angi_available is set for SLES 16" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_saphanasr_angi_available: true + when: + - ansible_distribution_major_version | int > 15 diff --git a/roles/sap_ha_pacemaker_cluster/tasks/configure_srhook.yml b/roles/sap_ha_pacemaker_cluster/tasks/configure_srhook.yml index aac210639..9acfe096d 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/configure_srhook.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/configure_srhook.yml @@ -26,14 +26,14 @@ __sap_ha_pacemaker_cluster_hana_hook_chksrv: false # tkover and chksrv variables are updated if their providers are detected - - name: "SAP HA Pacemaker srHook - Set tkover true if present" + - name: "SAP HA Pacemaker srHook - Set tkover true if defined and enabled" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_hana_hook_tkover: true when: - sap_ha_pacemaker_cluster_hana_hooks | selectattr( 'provider', 'search', 'tkover', 'i') | list | length > 0 - - name: "SAP HA Pacemaker srHook - Set chksrv true if present" + - name: "SAP HA Pacemaker srHook - Set chksrv true if defined and enabled" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_hana_hook_chksrv: true when: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml index 5c1681fad..a7fabc31b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml @@ -9,7 +9,9 @@ __constraint_order_vip: id: "{{ __sap_ha_pacemaker_cluster_hana_order_hana_vip_primary_name }}" resource_first: - id: "{{ __sap_ha_pacemaker_cluster_hana_resource_clone_name }}" + id: "{{ __sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name + if __sap_ha_pacemaker_cluster_saphanasr_angi_available + else __sap_ha_pacemaker_cluster_hana_resource_clone_name }}" action: promote resource_then: id: "{{ __res_or_grp }}" @@ -48,7 +50,9 @@ __constraint_order_vip: id: "{{ __sap_ha_pacemaker_cluster_hana_order_hana_vip_secondary_name }}" resource_first: - id: "{{ __sap_ha_pacemaker_cluster_hana_resource_clone_name }}" + id: "{{ __sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name + if __sap_ha_pacemaker_cluster_saphanasr_angi_available + else __sap_ha_pacemaker_cluster_hana_resource_clone_name }}" action: start resource_then: id: "{{ __res_or_grp }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml index 38b7e3aea..bdc6ea6d2 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml @@ -26,19 +26,31 @@ - sap_ha_pacemaker_cluster_vip_client_interface == '' -# Include vars files based on the environment. -# Respect order for potential variable precedence. +# Load variable files in order: +# 1. Suse.yml / RedHat.yml - Specific to OS family. +# 2. SLES_15.yml / RedHat_9.yml - Specific to distribution (SLES, SLES_SAP or RedHat) and major release. +# 3. SLES_15.6.yml / RedHat_9.2 - Specific to distribution (SLES, SLES_SAP or RedHat) and minor release. +# 4. SLES_SAP_15.yml - Specific to distribution SLES_SAP and major release. +# 5. SLES_SAP_15.6.yml - Specific to distribution SLES_SAP and minor release. - name: "SAP HA Prepare Pacemaker - Include environment specific variables" - when: __sap_ha_pacemaker_cluster_vars_file is file - ansible.builtin.include_vars: "{{ __sap_ha_pacemaker_cluster_vars_file }}" - loop: - - "{{ ansible_os_family | lower }}.yml" - - "{{ ansible_distribution | lower }}.yml" - - >- - {{ ansible_distribution | lower ~ '_' ~ - ansible_distribution_major_version }}.yml - - >- - {{ ansible_distribution | lower ~ '_' ~ - ansible_distribution_version }}.yml + ansible.builtin.include_vars: "{{ __vars_file }}" + loop: "{{ __var_files }}" vars: - __sap_ha_pacemaker_cluster_vars_file: "{{ role_path }}/vars/{{ item }}" + __vars_file: "{{ role_path }}/vars/{{ item }}" + __distribution_major: "{{ ansible_distribution ~ '_' ~ ansible_distribution_major_version }}" + __distribution_minor: "{{ ansible_distribution ~ '_' ~ ansible_distribution_version }}" + # Enables loading of shared vars between SLES and SLES_SAP + __distribution_major_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_major_version }}" + __distribution_minor_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_version }}" + __var_files: >- + {{ + [ + ansible_os_family ~ '.yml', + (ansible_distribution ~ '.yml') if ansible_distribution != ansible_os_family else None, + (__distribution_major_split ~ '.yml') if __distribution_major_split != __distribution_major else None, + (__distribution_minor_split ~ '.yml') if __distribution_minor_split != __distribution_minor else None, + __distribution_major ~ '.yml', + __distribution_minor ~ '.yml' + ] | select('defined') | select('string') | list + }} + when: __vars_file is file diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml index cf7d537da..5ff62e75f 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml @@ -3,7 +3,7 @@ # Detect presence of SAPHanaSR-angi package before loading HANA variables # Detection of package availability was chosen instead of OS version check. # SAPHanaSR-angi will be retrofitted to older SP repositories in future. -- name: "SAP HA Prepare Pacemaker - Detect SAPHanaSR-angi availability" +- name: "SAP HA Install Pacemaker - Run SAP HANA pre-steps" ansible.builtin.include_tasks: file: "{{ ansible_facts['os_family'] }}/pre_steps_hana.yml" when: @@ -81,7 +81,7 @@ else sap_ha_pacemaker_cluster_hanacontroller_resource_name }}" __sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name: - "{{ 'mst_SAPHanaCon_' ~ __sap_ha_pacemaker_cluster_hana_sid ~ '_HDB' ~ __sap_ha_pacemaker_cluster_hana_instance_nr + "{{ ('mst' if ansible_os_family == 'Suse' else 'cln') ~ '_SAPHanaCon_' ~ __sap_ha_pacemaker_cluster_hana_sid ~ '_HDB' ~ __sap_ha_pacemaker_cluster_hana_instance_nr if sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name | string | length == 0 else sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_nwas.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_nwas.yml index ffbef8df0..0e43e5c5b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_nwas.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_nwas.yml @@ -13,7 +13,6 @@ when: - "(role_path + '/vars/' + include_item + '.yml') is file" - # Private variables are assigned following logic: # 1. Use backwards compatible var if new var is empty # 2. Use user input if new var is not empty @@ -391,3 +390,13 @@ # TODO: Remove backwards compatibility to typo __sap_ha_pacemaker_cluster_storage_nfs_filesystem_type: "{{ sap_ha_pacemaker_cluster_storage_nfs_filesytem_type | d(sap_ha_pacemaker_cluster_storage_nfs_filesystem_type) }}" + +# This must be run after the assignment of +# __sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount +# TODO: separate pre-steps from variable includes for NW and HANA +- name: "SAP HA Prepare Pacemaker - Run NETWEAVER pre-steps" + ansible.builtin.include_tasks: + file: "{{ ansible_facts['os_family'] }}/pre_steps_nwas_ascs_ers.yml" + when: + - ansible_os_family == 'RedHat' + - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0 diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml index 4ebd242bd..4cf7b2ef2 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml @@ -81,14 +81,14 @@ changed_when: false when: ansible_architecture == "ppc64le" -- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power - RSCT binary check" +- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power - Fail if RSCT binary is missing" ansible.builtin.fail: msg: Please install RSCT from IBM Power Systems service and productivity tools repository when: - ansible_architecture == "ppc64le" - __sap_ha_pacemaker_cluster_power_rsct_check.stdout == "" -- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power - RSCT binary check" +- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power - Run 'ctgethscid'" ansible.builtin.shell: | /opt/rsct/bin/ctgethscid register: __sap_ha_pacemaker_cluster_power_rsct_hscid diff --git a/roles/sap_ha_pacemaker_cluster/vars/redhat.yml b/roles/sap_ha_pacemaker_cluster/vars/RedHat.yml similarity index 84% rename from roles/sap_ha_pacemaker_cluster/vars/redhat.yml rename to roles/sap_ha_pacemaker_cluster/vars/RedHat.yml index d8fc31b45..967a2b993 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/redhat.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/RedHat.yml @@ -92,6 +92,8 @@ __sap_ha_pacemaker_cluster_platform_extra_packages_dict: # Dictionary with additional cluster packages for specific scenarios __sap_ha_pacemaker_cluster_sap_extra_packages_dict: + hana_angi: + - sap-hana-ha hana_scaleout: - resource-agents-sap-hana-scaleout hana_scaleup: @@ -106,13 +108,10 @@ __sap_ha_pacemaker_cluster_sap_extra_packages_dict: __sap_ha_pacemaker_cluster_resource_agents: saphanatopology: "ocf:heartbeat:SAPHanaTopology" saphana: "ocf:heartbeat:SAPHana" -# TODO: Uncomment when SAPHanaSR-angi is available on Red Hat -# saphanacontroller: "ocf:heartbeat:SAPHanaController" -# saphanafilesystem: "ocf:heartbeat:SAPHanaFilesystem" -# TODO: Uncomment when SAPStartSrv is available on Red Hat -# sapstartsrv: "ocf:heartbeat:SAPStartSrv" + saphanacontroller: "ocf:heartbeat:SAPHanaController" + saphanafilesystem: "ocf:heartbeat:SAPHanaFilesystem" + sapstartsrv: "ocf:heartbeat:SAPStartSrv" -# TODO: Uncomment when SAPHanaSR-angi is available on Red Hat __sap_ha_pacemaker_cluster_saphanasr_angi_available: false # Default SAP HANA hook parameters combined based on user decision @@ -123,19 +122,41 @@ __sap_ha_pacemaker_cluster_hook_hana_scaleup_perf: options: - name: execution_order value: 1 -# TODO: Add additional hooks + chksrv: + - provider: ChkSrv + path: /usr/share/SAPHanaSR/srHook/ + options: + - name: execution_order + value: 2 + - name: action_on_lost + value: stop + +__sap_ha_pacemaker_cluster_hook_hana_scaleup_perf_angi: + saphanasr: + - provider: HanaSR + path: /usr/share/sap-hana-ha/ + options: + - name: execution_order + value: 1 + chksrv: + - provider: ChkSrv + path: /usr/share/sap-hana-ha/ + options: + - name: execution_order + value: 2 + - name: action_on_lost + value: stop + - name: stop_timeout + value: 25 -# Placeholder dictionaries -# TODO: Define hooks when SAPHanaSR-angi is available on Red Hat -__sap_ha_pacemaker_cluster_hook_hana_scaleup_perf_angi: [] __sap_ha_pacemaker_cluster_hook_hana_scaleout: [] __sap_ha_pacemaker_cluster_hook_hana_scaleout_angi: [] -# Disabled additional hooks until they are present in dictionary above -# TODO: Remove when additional hooks are specified above. -__sap_ha_pacemaker_cluster_hana_hook_tkover: false -__sap_ha_pacemaker_cluster_hana_hook_chksrv: false +# Enable default OS recommended hooks +sap_ha_pacemaker_cluster_hana_hook_tkover: false +sap_ha_pacemaker_cluster_hana_hook_chksrv: true # Central Services Cluster Simple Mount: Enabled as default # TODO: Enable when SAPStartSrv resource agents are available on Red Hat -sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount: false +sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount: true +__sap_ha_pacemaker_cluster_nwas_simple_mount_version: 4.15.1 diff --git a/roles/sap_ha_pacemaker_cluster/vars/SLES_15.yml b/roles/sap_ha_pacemaker_cluster/vars/SLES_15.yml new file mode 100644 index 000000000..e97f264f1 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/vars/SLES_15.yml @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: Apache-2.0 +--- +# Variables specific to following versions: +# - SUSE Linux Enterprise Server for SAP Applications 15 +# - SUSE Linux Enterprise Server 15 + +__sap_ha_pacemaker_cluster_sap_extra_packages_dict: + minimal: + # Pattern contains all required cluster packages + - patterns-ha-ha_sles + - ClusterTools2 + hana_scaleout: + - SAPHanaSR-ScaleOut + hana_scaleup: + - SAPHanaSR + hana_angi: + - SAPHanaSR-angi + nwas: + - sap-suse-cluster-connector + - sapstartsrv-resource-agents diff --git a/roles/sap_ha_pacemaker_cluster/vars/SLES_16.yml b/roles/sap_ha_pacemaker_cluster/vars/SLES_16.yml new file mode 100644 index 000000000..8a9f66af2 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/vars/SLES_16.yml @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: Apache-2.0 +--- +# Variables specific to following versions: +# - SUSE Linux Enterprise Server for SAP Applications 16 +# - SUSE Linux Enterprise Server 16 + +# Dictionary with additional cluster packages for specific scenarios +__sap_ha_pacemaker_cluster_sap_extra_packages_dict: + minimal: [] # All minimal packages are part of patterns + hana_scaleout: + - patterns-sap-HADB + hana_scaleup: + - patterns-sap-HADB + hana_angi: [] # SAPHanaSR-angi package is part of patterns-sap-HADB + nwas: + - patterns-sap-HAAPP + +# Package list was simplified because of new patterns below: + +# patterns-sap-HADB contains: +# - patterns-sles_sap_DB +# - patterns-ha-ha_sles +# - SAPHanaSR-angi +# - ClusterTools2 +# - supportutils-plugin-ha-sap +# - socat + +# patterns-sap-HAAPP contains: +# - patterns-sles_sap_APP +# - patterns-ha-ha_sles +# - sapstartsrv-resource-agents +# - sap-suse-cluster-connector +# - ClusterTools2 +# - supportutils-plugin-ha-sap +# - socat diff --git a/roles/sap_ha_pacemaker_cluster/vars/suse.yml b/roles/sap_ha_pacemaker_cluster/vars/Suse.yml similarity index 94% rename from roles/sap_ha_pacemaker_cluster/vars/suse.yml rename to roles/sap_ha_pacemaker_cluster/vars/Suse.yml index e8fe64ee8..18cd8dfcf 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/suse.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/Suse.yml @@ -50,19 +50,9 @@ __sap_ha_pacemaker_cluster_platform_extra_packages_dict: - socat # Dictionary with additional cluster packages for specific scenarios +# All packages are defined in SLES_15 and SLES_16 var files. __sap_ha_pacemaker_cluster_sap_extra_packages_dict: - minimal: - - ClusterTools2 - - resource-agents - hana_scaleout: - - SAPHanaSR-ScaleOut - hana_scaleup: - - SAPHanaSR - hana_angi: - - SAPHanaSR-angi - nwas: - - sap-suse-cluster-connector - - sapstartsrv-resource-agents + {} # Dictionary with preferred platform specific VIP method that differs from default __sap_ha_pacemaker_cluster_vip_method_dict: @@ -132,5 +122,9 @@ __sap_ha_pacemaker_cluster_hook_hana_scaleup_perf_angi: __sap_ha_pacemaker_cluster_hook_hana_scaleout: [] __sap_ha_pacemaker_cluster_hook_hana_scaleout_angi: [] +# Enable default OS recommended hooks +sap_ha_pacemaker_cluster_hana_hook_tkover: true +sap_ha_pacemaker_cluster_hana_hook_chksrv: true + # Central Services Cluster Simple Mount: Enabled as default sap_ha_pacemaker_cluster_nwas_cs_ers_simple_mount: true diff --git a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_perf.yml b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_perf.yml index d471f5f73..1801b2fbe 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_perf.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_perf.yml @@ -20,11 +20,15 @@ __sap_ha_pacemaker_cluster_hana_hook_dictionary: # Recommended srhooks are set to true only if default dictionary is populated __sap_ha_pacemaker_cluster_hana_hook_tkover: - "{{ true if lookup('ansible.builtin.vars', __sap_ha_pacemaker_cluster_hana_hook_dictionary).tkover - is defined else false }}" + "{{ true if + (lookup('ansible.builtin.vars', __sap_ha_pacemaker_cluster_hana_hook_dictionary).tkover + is defined and (sap_ha_pacemaker_cluster_hana_hook_tkover | bool)) + else false }}" __sap_ha_pacemaker_cluster_hana_hook_chksrv: - "{{ true if lookup('ansible.builtin.vars', __sap_ha_pacemaker_cluster_hana_hook_dictionary).chksrv - is defined else false }}" + "{{ true if + (lookup('ansible.builtin.vars', __sap_ha_pacemaker_cluster_hana_hook_dictionary).chksrv + is defined and (sap_ha_pacemaker_cluster_hana_hook_chksrv | bool)) + else false }}" # Combine final list of srhooks based on user input and angi availability __sap_ha_pacemaker_cluster_hana_hooks: "{{ diff --git a/roles/sap_hana_install/defaults/main.yml b/roles/sap_hana_install/defaults/main.yml index 6d4f47d38..6971068cf 100644 --- a/roles/sap_hana_install/defaults/main.yml +++ b/roles/sap_hana_install/defaults/main.yml @@ -30,19 +30,23 @@ sap_hana_install_copy_sarfiles: false # removed after extraction. sap_hana_install_keep_copied_sarfiles: false +# (RedHat specific) fapolicyd package is present on RedHat systems # For installing SAP HANA with fapolicyd support, set the following variable to `true`: sap_hana_install_use_fapolicyd: false +# (RedHat specific) fapolicyd package is present on RedHat systems # When using fapolicyd, you can set the following variable to one of `none`, `size`, `sha256`, or `ima`. Note that before setting # to `ima`, it is essential to prepare the system accordingly (e.g. boot with a different kernel parameter). See the # RHEL 9 Managing, monitoring, and updating the kernel guide for more information on this topic. sap_hana_install_fapolicyd_integrity: 'sha256' +# (RedHat specific) fapolicyd package is present on RedHat systems # When using fapolicyd, the following variable is used to define the fapolicyd rule file in which the rules for # protecting shell scripts are stored. The rule file will be created in the directory '/etc/fapolicyd/rules.d'. # Note: The mandatory file ending '.rules' will be added in the corresponding task of this role. sap_hana_install_fapolicyd_rule_file: '71-sap-shellscripts' +# (RedHat specific) fapolicyd package is present on RedHat systems # When using fapolicyd, modify the following variable to change or add the directories which contain SAP HANA executables: sap_hana_install_fapolicyd_trusted_directories: - "{{ sap_hana_install_root_path }}" @@ -50,11 +54,11 @@ sap_hana_install_fapolicyd_trusted_directories: # File name of SAPCAR*EXE in the software directory. If the variable is not set and there is more than one SAPCAR executable # in the software directory, the latest SAPCAR executable for the CPU architecture will be selected automatically. -#sap_hana_install_sapcar_filename: SAPCAR_1115-70006178.EXE +# sap_hana_install_sapcar_filename: SAPCAR_1115-70006178.EXE # List of file names of SAR files to extract. Can be set in case there are more SAR files in the software directory # than needed or desired for the HANA installation. -#sap_hana_install_sarfiles: +# sap_hana_install_sarfiles: # - SAPHOSTAGENT54_54-80004822.SAR # - IMDB_SERVER20_060_0-80002031.SAR @@ -67,7 +71,7 @@ sap_hana_install_verify_checksums: false sap_hana_install_checksum_algorithm: sha256 # In case a global checksum file is present, use the following variable to specify the full path to this file: -#sap_hana_install_global_checksum_file: "{{ sap_hana_install_software_directory }}/SHA256" +# sap_hana_install_global_checksum_file: "{{ sap_hana_install_software_directory }}/SHA256" # Set the following variable to `true` to let hdbclm verify SAR file signatures. This corresponds to the hdblcm command line # argument `--verify_signature`. @@ -126,8 +130,8 @@ sap_hana_install_modify_selinux_labels: true sap_hana_install_components: 'all' # Pass some extra arguments to hdblcm, see some examples below. -#sap_hana_install_hdblcm_extraargs: '--verify_signature' -#sap_hana_install_hdblcm_extraargs: '--ignore=check_diskspace,check_min_mem' +# sap_hana_install_hdblcm_extraargs: '--verify_signature' +# sap_hana_install_hdblcm_extraargs: '--ignore=check_diskspace,check_min_mem' # Instance details sap_hana_install_sid: @@ -154,15 +158,15 @@ sap_hana_install_groupid: # Setting master password to 'y' will use that master password for all passwords - recommended sap_hana_install_use_master_password: 'y' # Set one or more of the following password variables in your playbook or inventory. -#sap_hana_install_master_password: -#sap_hana_install_sidadm_password: -#sap_hana_install_db_system_password: -#sap_hana_install_lss_user_password: -#sap_hana_install_lss_backup_password: -#sap_hana_install_ase_user_password: -#sap_hana_install_root_password: -#sap_hana_install_sapadm_password: -#sap_hana_install_xs_org_password: +# sap_hana_install_master_password: +# sap_hana_install_sidadm_password: +# sap_hana_install_db_system_password: +# sap_hana_install_lss_user_password: +# sap_hana_install_lss_backup_password: +# sap_hana_install_ase_user_password: +# sap_hana_install_root_password: +# sap_hana_install_sapadm_password: +# sap_hana_install_xs_org_password: # Optional steps sap_hana_install_update_firewall: false @@ -191,7 +195,7 @@ sap_hana_install_firewall: state: 'enabled' } # The following variable is no longer used. Setting /etc/hosts entries is done in role sap_general_preconfigure. -#sap_hana_install_update_etchosts: true +# sap_hana_install_update_etchosts: true # Post install parameters sap_hana_install_hdbuserstore_key: 'HDB_SYSTEMDB' @@ -199,8 +203,8 @@ sap_hana_install_nw_input_location: '/tmp' # License sap_hana_install_apply_license: false -#sap_hana_install_license_path: -#sap_hana_install_license_file_name: +# sap_hana_install_license_path: +# sap_hana_install_license_file_name: # Misc @@ -220,13 +224,13 @@ sap_hana_install_create_initial_tenant: 'y' # If unset or set to 'normal', the role will leave the log_mode to 'normal', which is required for SAP HANA # System Replication. The log_mode 'overwrite' is useful for limiting cost or capacity if System Replication # is not used. -#sap_hana_install_log_mode: 'overwrite' +# sap_hana_install_log_mode: 'overwrite' # If the following variable is specified, the role will perform a scaleout installation or it will add additional # hosts to an existing HANA system. # Corresponding hdblcm parameter: addhosts # Example: -#sap_hana_install_addhosts: 'host2:role=worker,host3:role=worker:group=g02,host4:role=standby:group=g02' +# sap_hana_install_addhosts: 'host2:role=worker,host3:role=worker:group=g02,host4:role=standby:group=g02' # The hostname is set by 'hdblcm --dump_configfile_template' during the preinstall phase but can also # be set to a different value in your playbook or hostvars: diff --git a/roles/sap_hana_install/tasks/post_install.yml b/roles/sap_hana_install/tasks/post_install.yml index c276775b3..b774b3716 100644 --- a/roles/sap_hana_install/tasks/post_install.yml +++ b/roles/sap_hana_install/tasks/post_install.yml @@ -33,7 +33,7 @@ # Optional Post Install Tasks # not needed because already done in sap_general_preconfigure -#- name: SAP HANA Post Install - Update /etc/hosts +# - name: SAP HANA Post Install - Update /etc/hosts # ansible.builtin.include_tasks: post_install/update_etchosts.yml # when: # - "sap_hana_install_update_etchosts | bool" @@ -70,11 +70,13 @@ !/^ /&&/^\n")} /^ /{split ($0, b, "[\*\*\*]"); gsub (">", ""); split ($0, a, "<"); printf ("%s\{\{ sap_hana_install_%s | d(sap_hana_install_master_password) \}\}%s\n", b[1], a[2], b[4])}' {{ sap_hana_install_configfile_directory }}/{{ sap_hana_install_configfile_template_prefix }}.cfg.xml > {{ sap_hana_install_configfile_directory }}/{{ sap_hana_install_configfile_template_prefix }}.xml.j2 register: __sap_hana_install_create_jinja2_template - changed_when: no + changed_when: false - name: SAP HANA hdblcm installation check - Display the location of the remote Jinja2 template ansible.builtin.debug: - msg: "The Jinja2 template for creating the hdblcm configfile xml has been saved to '{{ sap_hana_install_configfile_directory }}/{{ sap_hana_install_configfile_template_prefix }}.xml.j2'." + msg: | + The Jinja2 template for creating the hdblcm configfile xml has been saved to + '{{ sap_hana_install_configfile_directory }}/{{ sap_hana_install_configfile_template_prefix }}.xml.j2'. - name: SAP HANA hdblcm installation check - Download the Jinja2 template ansible.builtin.fetch: @@ -155,7 +157,7 @@ args: chdir: "{{ sap_hana_install_shared_path }}/{{ sap_hana_install_sid }}/hdblcm" register: __sap_hana_install_register_install_result - changed_when: no + changed_when: false when: not ansible_check_mode - name: Configure '/usr/sap' SELinux file contexts @@ -205,7 +207,7 @@ # - ' FQDN - {{ ansible_fqdn }}' when: not ansible_check_mode -- name: SAP HANA Post Install, fapolicyd - Update config for desired integrity level and backout if validation fails +- name: SAP HANA Post Install, fapolicyd - Update config for desired integrity level and revert if validation fails when: - sap_hana_install_use_fapolicyd - '"fapolicyd" in ansible_facts.packages' diff --git a/roles/sap_hana_install/tasks/post_install/firewall.yml b/roles/sap_hana_install/tasks/post_install/firewall.yml index aa7ede64e..a213584ac 100644 --- a/roles/sap_hana_install/tasks/post_install/firewall.yml +++ b/roles/sap_hana_install/tasks/post_install/firewall.yml @@ -5,7 +5,7 @@ ansible.builtin.systemd: name: firewalld state: started - enabled: yes + enabled: true tags: sap_hana_install_configure_firewall - name: SAP HANA Post Install - Construct the argument list for 'firewall-cmd --add-port' @@ -38,12 +38,12 @@ # of the no-changed-when rule, we just set changed_when to true here. - name: SAP HANA Post Install - Enable the required ports immediately ansible.builtin.command: "{{ __sap_hana_install_fact_firewall_cmd_command }}" - changed_when: yes + changed_when: true tags: sap_hana_install_configure_firewall - name: SAP HANA Post Install - Get the current firewall configuration of the default zone ansible.builtin.command: firewall-cmd --list-all - changed_when: no + changed_when: false register: __sap_hana_install_register_current_firewall_ports tags: sap_hana_install_configure_firewall @@ -57,12 +57,12 @@ # of the no-changed-when rule, we just set changed_when to true here. - name: SAP HANA Post Install - Enable the required ports permanently ansible.builtin.command: "{{ __sap_hana_install_fact_firewall_cmd_command }} --permanent" - changed_when: yes + changed_when: true tags: sap_hana_install_configure_firewall - name: SAP HANA Post Install - Get the permanent firewall configuration of the default zone ansible.builtin.command: firewall-cmd --list-all - changed_when: no + changed_when: false register: __sap_hana_install_register_permanent_firewall_ports tags: sap_hana_install_configure_firewall diff --git a/roles/sap_hana_install/tasks/post_install/update_firewall.yml b/roles/sap_hana_install/tasks/post_install/update_firewall.yml index a00d83048..d5fca3fe3 100644 --- a/roles/sap_hana_install/tasks/post_install/update_firewall.yml +++ b/roles/sap_hana_install/tasks/post_install/update_firewall.yml @@ -6,6 +6,6 @@ ansible.posix.firewalld: zone: public port: "{{ passed_port }}/tcp" - permanent: yes - immediate: yes + permanent: true + immediate: true state: enabled diff --git a/roles/sap_hana_install/tasks/pre_install.yml b/roles/sap_hana_install/tasks/pre_install.yml index 22fef6159..d0c576020 100644 --- a/roles/sap_hana_install/tasks/pre_install.yml +++ b/roles/sap_hana_install/tasks/pre_install.yml @@ -4,16 +4,16 @@ # Password Facts ################ -#- name: SAP HANA Pre Install - Set password facts when using master password -# ansible.builtin.set_fact: -# sap_hana_install_sapadm_password: "{{ sap_hana_install_master_password }}" -# sap_hana_install_sidadm_password: "{{ sap_hana_install_master_password }}" -# sap_hana_install_db_system_password: "{{ sap_hana_install_master_password }}" -# sap_hana_install_ase_user_password: "{{ sap_hana_install_master_password }}" -# sap_hana_install_xs_org_password: "{{ sap_hana_install_master_password }}" -# sap_hana_install_lss_user_password: "{{ sap_hana_install_master_password }}" -# sap_hana_install_lss_backup_password: "{{ sap_hana_install_master_password }}" -# when: sap_hana_install_use_master_password == 'y' +# - name: SAP HANA Pre Install - Set password facts when using master password +# ansible.builtin.set_fact: +# sap_hana_install_sapadm_password: "{{ sap_hana_install_master_password }}" +# sap_hana_install_sidadm_password: "{{ sap_hana_install_master_password }}" +# sap_hana_install_db_system_password: "{{ sap_hana_install_master_password }}" +# sap_hana_install_ase_user_password: "{{ sap_hana_install_master_password }}" +# sap_hana_install_xs_org_password: "{{ sap_hana_install_master_password }}" +# sap_hana_install_lss_user_password: "{{ sap_hana_install_master_password }}" +# sap_hana_install_lss_backup_password: "{{ sap_hana_install_master_password }}" +# when: sap_hana_install_use_master_password == 'y' ################ # Handle fapolicyd @@ -23,7 +23,10 @@ ansible.builtin.package: name: fapolicyd state: present - when: sap_hana_install_use_fapolicyd + when: + - sap_hana_install_use_fapolicyd + # Ensure fapolicyd is installed only on supported systems. + - ansible_os_family == 'RedHat' tags: sap_hana_install_use_fapolicyd ################ @@ -59,9 +62,9 @@ - name: SAP HANA Pre Install - Check availability of software directory '{{ __sap_hana_install_fact_software_directory }}' ansible.builtin.stat: path: "{{ __sap_hana_install_fact_software_directory }}" - check_mode: no + check_mode: false register: __sap_hana_install_register_stat_software_directory - failed_when: no + failed_when: false - name: SAP HANA Pre Install - Assert that the software directory exists ansible.builtin.assert: @@ -69,7 +72,9 @@ fail_msg: "FAIL: The software directory '{{ __sap_hana_install_fact_software_directory }}' does not exist!" success_msg: "PASS: The software directory '{{ __sap_hana_install_fact_software_directory }}' exist." - - name: SAP HANA Pre Install - Assert directory permissions in case `sap_hana_install_software_extract_directory` is below `sap_hana_install_software_extract_directory` + - name: > + SAP HANA Pre Install - Assert directory permissions in case `sap_hana_install_software_extract_directory` + is below `sap_hana_install_software_extract_directory` when: sap_hana_install_software_extract_directory is search(sap_hana_install_software_directory) block: @@ -135,15 +140,15 @@ - name: SAP HANA Pre Install - Get info about software extract directory '{{ sap_hana_install_software_extract_directory }}' ansible.builtin.stat: path: "{{ sap_hana_install_software_extract_directory }}" - check_mode: no + check_mode: false register: __sap_hana_install_register_stat_software_extract_directory - failed_when: no + failed_when: false - name: SAP HANA Pre Install - Change ownership of software extract directory '{{ sap_hana_install_software_extract_directory }}' ansible.builtin.file: path: "{{ sap_hana_install_software_extract_directory }}" state: directory - recurse: yes + recurse: true mode: '0755' owner: root group: root @@ -154,12 +159,12 @@ ansible.builtin.wait_for: path: "{{ sap_hana_install_software_extract_directory }}/__EXTRACTION_ONGOING__" state: absent - failed_when: no + failed_when: false - name: SAP HANA Pre Install - Find directory 'SAP_HANA_DATABASE' if '{{ sap_hana_install_software_extract_directory }}' exists ansible.builtin.find: paths: "{{ sap_hana_install_software_extract_directory }}" - recurse: yes + recurse: true file_type: directory patterns: 'SAP_HANA_DATABASE' register: __sap_hana_install_register_find_directory_sap_hana_database_initial @@ -178,9 +183,9 @@ - name: SAP HANA Pre Install - Get info about '{{ __sap_hana_install_fact_hdblcm_path }}/hdblcm' if found initially ansible.builtin.stat: path: "{{ __sap_hana_install_fact_hdblcm_path + '/hdblcm' }}" - check_mode: no + check_mode: false register: __sap_hana_install_register_stat_hdblcm_initial - failed_when: no + failed_when: false - name: SAP HANA Pre Install - Assert that file 'hdblcm' is available if found initially ansible.builtin.assert: @@ -207,9 +212,9 @@ - name: SAP HANA Pre Install - Get info about '{{ __sap_hana_install_fact_hdblcm_path }}/hdblcm' ansible.builtin.stat: path: "{{ __sap_hana_install_fact_hdblcm_path + '/hdblcm' }}" - check_mode: no + check_mode: false register: __sap_hana_install_register_stat_hdblcm - failed_when: no + failed_when: false - name: SAP HANA Pre Install - Assert that file 'hdblcm' is available ansible.builtin.assert: @@ -227,7 +232,7 @@ - name: SAP HANA Pre Install - Find directory 'SAP_HANA_DATABASE' in '{{ sap_hana_install_software_extract_directory }}' ansible.builtin.find: paths: "{{ sap_hana_install_software_extract_directory }}" - recurse: yes + recurse: true file_type: directory patterns: 'SAP_HANA_DATABASE' register: __sap_hana_install_register_find_directory_sap_hana_database_addhosts diff --git a/roles/sap_hana_install/tasks/pre_install/hdblcm_prepare.yml b/roles/sap_hana_install/tasks/pre_install/hdblcm_prepare.yml index bdff8d74d..b112b322c 100644 --- a/roles/sap_hana_install/tasks/pre_install/hdblcm_prepare.yml +++ b/roles/sap_hana_install/tasks/pre_install/hdblcm_prepare.yml @@ -55,7 +55,7 @@ - name: SAP HANA hdblcm prepare - Find 'SAP_HANA_DATABASE' in '{{ sap_hana_install_software_extract_directory }}' ansible.builtin.find: paths: "{{ sap_hana_install_software_extract_directory }}" - recurse: yes + recurse: true file_type: directory patterns: 'SAP_HANA_DATABASE' register: __sap_hana_install_register_find_directory_sap_hana_database diff --git a/roles/sap_hana_install/tasks/pre_install/prepare_sarfiles.yml b/roles/sap_hana_install/tasks/pre_install/prepare_sarfiles.yml index 299e8dbbe..3131e844c 100644 --- a/roles/sap_hana_install/tasks/pre_install/prepare_sarfiles.yml +++ b/roles/sap_hana_install/tasks/pre_install/prepare_sarfiles.yml @@ -23,7 +23,7 @@ - name: SAP HANA hdblcm prepare - Find all SAR files in '{{ __sap_hana_install_fact_software_directory }}' ansible.builtin.find: paths: "{{ __sap_hana_install_fact_software_directory }}" - recurse: no + recurse: false file_type: file patterns: '*.SAR' register: __sap_hana_install_register_find_sarfiles @@ -37,7 +37,7 @@ ansible.builtin.debug: var: __sap_hana_install_fact_sarfiles -- name: Copy SAR files to final destination if 'sap_hana_install_copy_sarfiles' is 'yes' +- name: Copy SAR files to final destination if 'sap_hana_install_copy_sarfiles' is 'true' when: sap_hana_install_copy_sarfiles block: diff --git a/roles/sap_hana_preconfigure/tasks/SLES/configuration.yml b/roles/sap_hana_preconfigure/tasks/SLES/configuration.yml index 61b9b0818..c58c71598 100644 --- a/roles/sap_hana_preconfigure/tasks/SLES/configuration.yml +++ b/roles/sap_hana_preconfigure/tasks/SLES/configuration.yml @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 --- -- name: Takover saptune and enable +- name: Takeover saptune and enable when: __sap_hana_preconfigure_run_saptune block: - name: Ensure sapconf is stopped and disabled diff --git a/roles/sap_hana_preconfigure/tasks/main.yml b/roles/sap_hana_preconfigure/tasks/main.yml index 1708ca6aa..ef63a0b8a 100644 --- a/roles/sap_hana_preconfigure/tasks/main.yml +++ b/roles/sap_hana_preconfigure/tasks/main.yml @@ -5,21 +5,35 @@ ansible.builtin.debug: var: role_path -# Load variable file starting with actual version up to OS family. -# Example for SUSE Linux Enterprise Server for SAP Applications 15 SP6: -# 1. SLES_SAP_15.6.yml - Specific to distribution with major and minor release. -# 2. SLES_SAP_15.yml - Specific to distribution and major release regardless of minor release. -# 3. SLES_15.6.yml - Specific to distribution family (SLES and SLES4SAP) and minor release. -# 4. SLES_15.yml - Specific to distribution. -# 5. Suse.yml - Specific to OS family. -- name: Include OS specific vars - ansible.builtin.include_vars: '{{ item }}' - with_first_found: - - '{{ ansible_distribution }}_{{ ansible_distribution_version }}.yml' - - '{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.yml' - - '{{ ansible_distribution.split("_")[0] }}_{{ ansible_distribution_version }}.yml' - - '{{ ansible_distribution.split("_")[0] }}_{{ ansible_distribution_major_version }}.yml' - - '{{ ansible_os_family }}.yml' +# Load variable files in order: +# 1. Suse.yml / RedHat.yml - Specific to OS family. +# 2. SLES_15.yml / RedHat_9.yml - Specific to distribution (SLES, SLES_SAP or RedHat) and major release. +# 3. SLES_15.6.yml / RedHat_9.2 - Specific to distribution (SLES, SLES_SAP or RedHat) and minor release. +# 4. SLES_SAP_15.yml - Specific to distribution SLES_SAP and major release. +# 5. SLES_SAP_15.6.yml - Specific to distribution SLES_SAP and minor release. +- name: Include OS specific vars, specific + ansible.builtin.include_vars: "{{ __vars_file }}" + loop: "{{ __var_files }}" + vars: + __vars_file: "{{ role_path }}/vars/{{ item }}" + __distribution_major: "{{ ansible_distribution ~ '_' ~ ansible_distribution_major_version }}" + __distribution_minor: "{{ ansible_distribution ~ '_' ~ ansible_distribution_version }}" + # Enables loading of shared vars between SLES and SLES_SAP + __distribution_major_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_major_version }}" + __distribution_minor_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_version }}" + __var_files: >- + {{ + [ + ansible_os_family ~ '.yml', + (ansible_distribution ~ '.yml') if ansible_distribution != ansible_os_family else None, + (__distribution_major_split ~ '.yml') if __distribution_major_split != __distribution_major else None, + (__distribution_minor_split ~ '.yml') if __distribution_minor_split != __distribution_minor else None, + __distribution_major ~ '.yml', + __distribution_minor ~ '.yml' + ] | select('defined') | select('string') | list + }} + when: __vars_file is file + - name: Set filename prefix to empty string if role is run in normal mode ansible.builtin.set_fact: diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 034285ef6..94f5d6e09 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -286,7 +286,7 @@ for _FILE in "$@"; do /db2setup/{_sap_file_type="ibmdb2"; exit} /db6_update_client.sh/{_sap_file_type="ibmdb2_client"; exit} /db2aese_c.lic/{_sap_file_type="ibmdb2_license"; exit} - /DATA_UNITS\/JAVA_EXPORT_JDMP/{_sap_file_type="sap_export_nwas_java"; exit} + /DATA_UNITS\/JAVA_EXPORT_JDMP/{_sap_file_type="sap_export_nwas_java"} /DATA_UNITS\/EXPORT/{_sap_file_type="sap_export_ecc"; exit} /DATA_UNITS\/EXP[0-9]/{_sap_file_type="sap_export_nwas_abap"; exit} /DATA_UNITS\/SOLMAN/&&/_JAVA_UT/{_sap_file_type="sap_export_solman_java"; exit} diff --git a/roles/sap_netweaver_preconfigure/defaults/main.yml b/roles/sap_netweaver_preconfigure/defaults/main.yml index 0a458da5b..a1bea12c0 100644 --- a/roles/sap_netweaver_preconfigure/defaults/main.yml +++ b/roles/sap_netweaver_preconfigure/defaults/main.yml @@ -5,7 +5,7 @@ # Perform an assertion run: sap_netweaver_preconfigure_assert: false -# In case of an assertion run, if set to "yes", the role will abort for any assertion error: +# In case of an assertion run, if set to true, the role will abort for any assertion error: sap_netweaver_preconfigure_assert_ignore_errors: false sap_netweaver_preconfigure_min_swap_space_mb: '20480' diff --git a/roles/sap_netweaver_preconfigure/tasks/RedHat/assert-installation.yml b/roles/sap_netweaver_preconfigure/tasks/RedHat/assert-installation.yml index d5d271e27..2c1f8eac1 100644 --- a/roles/sap_netweaver_preconfigure/tasks/RedHat/assert-installation.yml +++ b/roles/sap_netweaver_preconfigure/tasks/RedHat/assert-installation.yml @@ -16,7 +16,7 @@ - name: Check if required packages for Adobe Document Services are installed # noqa command-instead-of-module ansible.builtin.shell: rpm -q --qf "%{NAME}.%{ARCH}\n" {{ __sap_netweaver_preconfigure_adobe_doc_services_packages | map('quote') | join(' ') }} register: __sap_netweaver_preconfigure_register_rpm_q_ads_packages - changed_when: no + changed_when: false when: sap_netweaver_preconfigure_use_adobe_doc_services | d(false) ignore_errors: "{{ sap_netweaver_preconfigure_assert_ignore_errors | d(false) }}" diff --git a/roles/sap_netweaver_preconfigure/tasks/RedHat/configuration.yml b/roles/sap_netweaver_preconfigure/tasks/RedHat/configuration.yml index 7ab03d9dd..d169bfe26 100644 --- a/roles/sap_netweaver_preconfigure/tasks/RedHat/configuration.yml +++ b/roles/sap_netweaver_preconfigure/tasks/RedHat/configuration.yml @@ -14,17 +14,19 @@ - name: Warn if not enough swap space is configured ansible.builtin.fail: - msg: "The system has only {{ ansible_swaptotal_mb }} MB of swap space configured, - which is less than the minimum required amount of {{ sap_netweaver_preconfigure_min_swap_space_mb }} MB for SAP NetWeaver!" - ignore_errors: yes + msg: | + The system has only {{ ansible_swaptotal_mb }} MB of swap space configured, + which is less than the minimum required amount of {{ sap_netweaver_preconfigure_min_swap_space_mb }} MB for SAP NetWeaver! + ignore_errors: true when: - ansible_swaptotal_mb < sap_netweaver_preconfigure_min_swap_space_mb|int - not sap_netweaver_preconfigure_fail_if_not_enough_swap_space_configured|d(true) - name: Fail if not enough swap space is configured ansible.builtin.fail: - msg: "The system has only {{ ansible_swaptotal_mb }} MB of swap space configured, - which is less than the minimum required amount of {{ sap_netweaver_preconfigure_min_swap_space_mb }} MB for SAP NetWeaver!" + msg: | + The system has only {{ ansible_swaptotal_mb }} MB of swap space configured, + which is less than the minimum required amount of {{ sap_netweaver_preconfigure_min_swap_space_mb }} MB for SAP NetWeaver! when: - ansible_swaptotal_mb < sap_netweaver_preconfigure_min_swap_space_mb|int - sap_netweaver_preconfigure_fail_if_not_enough_swap_space_configured|d(true) diff --git a/roles/sap_netweaver_preconfigure/tasks/main.yml b/roles/sap_netweaver_preconfigure/tasks/main.yml index f0a525abd..2f99c60a1 100644 --- a/roles/sap_netweaver_preconfigure/tasks/main.yml +++ b/roles/sap_netweaver_preconfigure/tasks/main.yml @@ -5,21 +5,37 @@ ansible.builtin.debug: var: role_path -# Load variable file starting with actual version up to OS family. -# Example for SUSE Linux Enterprise Server for SAP Applications 15 SP6: -# 1. SLES_SAP_15.6.yml - Specific to distribution with major and minor release. -# 2. SLES_SAP_15.yml - Specific to distribution and major release regardless of minor release. -# 3. SLES_15.6.yml - Specific to distribution family (SLES and SLES4SAP) and minor release. -# 4. SLES_15.yml - Specific to distribution. -# 5. Suse.yml - Specific to OS family. -- name: Include OS specific vars - ansible.builtin.include_vars: '{{ item }}' - with_first_found: - - '{{ ansible_distribution }}_{{ ansible_distribution_version }}.yml' - - '{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.yml' - - '{{ ansible_distribution.split("_")[0] }}_{{ ansible_distribution_version }}.yml' - - '{{ ansible_distribution.split("_")[0] }}_{{ ansible_distribution_major_version }}.yml' - - '{{ ansible_os_family }}.yml' +# Load variable files in order: +# 1. Suse.yml / RedHat.yml - Specific to OS family. +# 2. SLES_15.yml / RedHat_9.yml - Specific to distribution (SLES, SLES_SAP or RedHat) and major release. +# 3. SLES_15.6.yml / RedHat_9.2 - Specific to distribution (SLES, SLES_SAP or RedHat) and minor release. +# 4. SLES_SAP_15.yml - Specific to distribution SLES_SAP and major release. +# 5. SLES_SAP_15.6.yml - Specific to distribution SLES_SAP and minor release. +- name: Include OS specific vars, specific + ansible.builtin.include_vars: "{{ __vars_file }}" + loop: "{{ __var_files }}" + vars: + __vars_file: "{{ role_path }}/vars/{{ item }}" + __distribution_major: "{{ ansible_distribution ~ '_' ~ ansible_distribution_major_version }}" + __distribution_minor: "{{ ansible_distribution ~ '_' ~ ansible_distribution_version }}" + # Enables loading of shared vars between SLES and SLES_SAP + __distribution_major_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_major_version }}" + __distribution_minor_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_version }}" + __var_files: >- + {{ + [ + ansible_os_family ~ '.yml', + (ansible_distribution ~ '.yml') if ansible_distribution != ansible_os_family else None, + (__distribution_major_split ~ '.yml') if __distribution_major_split != __distribution_major else None, + (__distribution_minor_split ~ '.yml') if __distribution_minor_split != __distribution_minor else None, + __distribution_major ~ '.yml', + __distribution_minor ~ '.yml' + ] | select('defined') | select('string') | list + }} + when: __vars_file is file + tags: + - always + - name: Set filename prefix to empty string if role is run in normal mode ansible.builtin.set_fact: diff --git a/roles/sap_netweaver_preconfigure/vars/SLES_15.6.yml b/roles/sap_netweaver_preconfigure/vars/SLES_15.6.yml index 34ad9619a..42032de73 100644 --- a/roles/sap_netweaver_preconfigure/vars/SLES_15.6.yml +++ b/roles/sap_netweaver_preconfigure/vars/SLES_15.6.yml @@ -8,28 +8,35 @@ __sap_netweaver_preconfigure_sapnotes: - "1275776" __sap_netweaver_preconfigure_packages: + # Mandatory packages + - tcsh + - acl + - insserv-compat + - system-user-uuidd + - uuidd + # gcc packages - libstdc++6 - libatomic1 - libgcc_s1 - libltdl7 - - insserv-compat + # System monitoring + - sysstat - cpupower - - hicolor-icon-theme - - libcpupower1 # libcpupower0 was removed in SP6 + - libcpupower1 - libsensors4 + # Patterns - patterns-base-basesystem - patterns-server-enterprise-sap_server - patterns-yast-yast2_basis + # Additional packages - procmail - - sysstat - - system-user-uuidd - - uuidd + # Not needed but kept for compatibility + - hicolor-icon-theme - yast2-auth-client - yast2-auth-server - yast2-theme - yast2-vpn - - tcsh - - acl + # SLES_SAP is using saptune, but SLES is using sapconf. # Default value true runs saptune, but installation.yml auto-detects base product and adjusts. diff --git a/roles/sap_netweaver_preconfigure/vars/SLES_15.yml b/roles/sap_netweaver_preconfigure/vars/SLES_15.yml index b6f0bacc6..cc632e33f 100644 --- a/roles/sap_netweaver_preconfigure/vars/SLES_15.yml +++ b/roles/sap_netweaver_preconfigure/vars/SLES_15.yml @@ -8,28 +8,34 @@ __sap_netweaver_preconfigure_sapnotes: - "1275776" __sap_netweaver_preconfigure_packages: + # Mandatory packages + - tcsh + - acl + - insserv-compat + - system-user-uuidd + - uuidd + # gcc packages - libstdc++6 - libatomic1 - libgcc_s1 - libltdl7 - - insserv-compat + # System monitoring + - sysstat - cpupower - - hicolor-icon-theme - libcpupower0 - libsensors4 + # Patterns - patterns-base-basesystem - patterns-server-enterprise-sap_server - patterns-yast-yast2_basis + # Additional packages - procmail - - sysstat - - system-user-uuidd - - uuidd + # Not needed but kept for compatibility + - hicolor-icon-theme - yast2-auth-client - yast2-auth-server - yast2-theme - yast2-vpn - - tcsh - - acl # SLES_SAP is using saptune, but SLES is using sapconf. # Default value true runs saptune, but installation.yml auto-detects base product and adjusts. diff --git a/roles/sap_swpm/defaults/main.yml b/roles/sap_swpm/defaults/main.yml index 28913cb74..89bf1902f 100644 --- a/roles/sap_swpm/defaults/main.yml +++ b/roles/sap_swpm/defaults/main.yml @@ -449,3 +449,6 @@ sap_swpm_update_etchosts: false # Display SAP SWPM Unattended Mode output (sapinst stdout) sap_swpm_display_unattended_output: false + +# Set which Ansible Collection to use when calling sap_install roles. +sap_swpm_sap_install_collection: 'community.sap_install' diff --git a/roles/sap_swpm/tasks/pre_install/generate_inifile.yml b/roles/sap_swpm/tasks/pre_install/generate_inifile.yml index 7a53ba7bb..2f4199677 100644 --- a/roles/sap_swpm/tasks/pre_install/generate_inifile.yml +++ b/roles/sap_swpm/tasks/pre_install/generate_inifile.yml @@ -105,11 +105,18 @@ sap_swpm_db_schema_password: "{{ sap_swpm_db_schema_java_password }}" when: "'Java' in sap_swpm_product_catalog_id" +# If the individual passwords are set to a non empty string, use those: - name: SAP SWPM Pre Install - Set other user passwords using master password ansible.builtin.set_fact: - sap_swpm_sapadm_password: "{{ sap_swpm_master_password }}" - sap_swpm_sap_sidadm_password: "{{ sap_swpm_master_password }}" - sap_swpm_diagnostics_agent_password: "{{ sap_swpm_master_password }}" + sap_swpm_sapadm_password: "{{ sap_swpm_master_password + if sap_swpm_master_password | d('') and not sap_swpm_sapadm_password | d('') + else sap_swpm_sapadm_password | d('') }}" + sap_swpm_sap_sidadm_password: "{{ sap_swpm_master_password + if sap_swpm_master_password | d('') and not sap_swpm_sap_sidadm_password | d('') + else sap_swpm_sap_sidadm_password | d('') }}" + sap_swpm_diagnostics_agent_password: "{{ sap_swpm_master_password + if sap_swpm_master_password | d('') and not sap_swpm_diagnostics_agent_password | d('') + else sap_swpm_diagnostics_agent_password | d('') }}" # Generate inifile.params, step 1: Process SWPM Configfile template locally for creating inifile.params - name: SAP SWPM Pre Install, create inifile - Process SWPM inifile template for creating 'inifile.params' diff --git a/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml index 6a1915edb..15490e497 100644 --- a/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml +++ b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml @@ -8,6 +8,7 @@ register: sap_swpm_tmpdir tags: - sap_swpm_sapinst_commandline + - sap_swpm_generate_inifile # Copy password file to the same location as inifile.params - name: SAP SWPM Pre Install - Copy password file to the same location as inifile.params diff --git a/roles/sap_swpm/tasks/pre_install/update_etchosts.yml b/roles/sap_swpm/tasks/pre_install/update_etchosts.yml index 815ae29e6..b5c97ab6f 100644 --- a/roles/sap_swpm/tasks/pre_install/update_etchosts.yml +++ b/roles/sap_swpm/tasks/pre_install/update_etchosts.yml @@ -12,7 +12,7 @@ - name: SAP SWPM Pre Install - Update '/etc/hosts' for NW ansible.builtin.import_role: - name: 'community.sap_install.sap_maintain_etc_hosts' + name: '{{ sap_swpm_sap_install_collection }}.sap_maintain_etc_hosts' vars: sap_maintain_etc_hosts_list: - node_ip: "{{ ansible_default_ipv4.address | d(ansible_all_ipv4_addresses[0]) }}" @@ -46,7 +46,7 @@ - name: SAP SWPM Pre Install - Update '/etc/hosts' for HANA ansible.builtin.import_role: - name: 'community.sap_install.sap_maintain_etc_hosts' + name: '{{ sap_swpm_sap_install_collection }}.sap_maintain_etc_hosts' vars: sap_maintain_etc_hosts_list: - node_ip: "{{ sap_swpm_db_ip }}" diff --git a/roles/sap_swpm/templates/inifile_params.j2 b/roles/sap_swpm/templates/inifile_params.j2 index 56da03da8..94f0cb8f4 100644 --- a/roles/sap_swpm/templates/inifile_params.j2 +++ b/roles/sap_swpm/templates/inifile_params.j2 @@ -801,7 +801,7 @@ UmeConfiguration.umeType = {{ sap_swpm_ume_type }} # BEGIN section nw_config_java_feature_template_ids # # # NW_internal.useProductVersionDescriptor = true -nw_java_import.buildJEEusingExtraMileTool = {{ true if sap_swpm_java_import_method == 'extramile' else false }} +nw_java_import.buildJEEusingExtraMileTool = {{ 'true' if sap_swpm_java_import_method == 'extramile' else 'false' }} # If use PV = true # SAP SWPM 1.0 for SAP NetWeaver AS (JAVA), Product Version Software Instance **Feature Template IDs** comma-separated list