-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #914 from mk-ansible-roles/issue-907
sap_general_preconfigure - Checking for english locales, issue 907
- Loading branch information
Showing
11 changed files
with
143 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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." |
36 changes: 36 additions & 0 deletions
36
roles/sap_general_preconfigure/tasks/sapnote/assert-2369910.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters