diff --git a/roles/sap_general_preconfigure/defaults/main.yml b/roles/sap_general_preconfigure/defaults/main.yml index 5cef8b737..7b40cc9b8 100644 --- a/roles/sap_general_preconfigure/defaults/main.yml +++ b/roles/sap_general_preconfigure/defaults/main.yml @@ -166,4 +166,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..1a35f7eee 100644 --- a/roles/sap_general_preconfigure/meta/argument_specs.yml +++ b/roles/sap_general_preconfigure/meta/argument_specs.yml @@ -341,3 +341,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/sapnote/2369910.yml b/roles/sap_general_preconfigure/tasks/sapnote/2369910.yml new file mode 100644 index 000000000..8e17e19e6 --- /dev/null +++ b/roles/sap_general_preconfigure/tasks/sapnote/2369910.yml @@ -0,0 +1,52 @@ +# 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: 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: Configure English locale + when: + - sap_general_preconfigure_default_locale is defined + - sap_general_preconfigure_default_locale | length > 0 + - __sap_general_preconfigure_locales_installed.stdout_lines | select('match', sap_general_preconfigure_default_locale | regex_replace('UTF-8', 'utf8')) | list | length > 0 + - sap_general_preconfigure_default_locale.startswith('en_') or sap_general_preconfigure_default_locale.startswith('C.UTF-8') + ansible.builtin.lineinfile: + path: /etc/locale.conf + regexp: ^LANG= + line: "LANG=\"{{ sap_general_preconfigure_default_locale }}\"" + state: present + create: true + owner: root + group: root + mode: '0644' + + - name: Get the current default locale + ansible.builtin.command: awk '/^LANG=/&&(/C.UTF-8/||/en_/){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/assert-2369910.yml b/roles/sap_general_preconfigure/tasks/sapnote/assert-2369910.yml new file mode 100644 index 000000000..c653619b5 --- /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 '/^LANG=/&&(/C.UTF-8/||/en_/){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/Suse.yml b/roles/sap_general_preconfigure/vars/Suse.yml index c1bba28a1..0103ed647 100644 --- a/roles/sap_general_preconfigure/vars/Suse.yml +++ b/roles/sap_general_preconfigure/vars/Suse.yml @@ -7,7 +7,7 @@ # - SUSE Linux Enterprise Server 16 __sap_general_preconfigure_sapnotes_versions: - - '' + - '' # { number: '2369910', version: '18'} __sap_general_preconfigure_packages: - uuidd