Ensure locale is set to en_US.UTF-8 for baremetal systems

RHEL 8.4 guest images set the locale to LANG=en_US
which results in error during the deploy.
This role ensure that the locale includes
LANG=en_US.UTF-8 after the image boots.

Related-Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1935345
Change-Id: I06dd113e41d4b47e74663cc5c7bea74434cfa0fc
This commit is contained in:
Ronelle Landy 2021-03-03 14:32:38 -05:00
parent 82ea5a85c5
commit 3d81be6217
2 changed files with 21 additions and 0 deletions

View File

@ -89,6 +89,17 @@
- ansible_distribution == 'CentOS'
- ansible_distribution_major_version|int >= 8
- name: Ensure locale has LANG=en_US.UTF-8
hosts: undercloud
gather_facts: false
tasks:
- include_role:
name: baremetal-prep-virthost
tasks_from: set_locale_UTF_8
when:
- ansible_distribution == 'RedHat'
- ansible_distribution_major_version|int >= 8
- name: Prepare the host for PXE forwarding
hosts: virthost
gather_facts: true

View File

@ -0,0 +1,10 @@
---
- name: Get current locale and language configuration
shell: localectl status | grep 'LANG'
register: locale_status
changed_when: false
- name: run localectl to set LANG=en_US.UTF-8
become: true
command: "localectl set-locale LANG=en_US.UTF-8"
when: '"LANG=en_US.UTF-8" not in locale_status.stdout'