I found the locale_gen module to make sure that locales are present on the system and tried it like described here:
- name: Install EN locale
locale_gen:
name: "de_DE.UTF-8"
state: present
- name: Install DE locale
locale_gen:
name: "en_US.UTF-8"
state: present
This throws an error:
/etc/locale.gen and /var/lib/locales/supported.d/local are missing. Is the package “locales” installed?
So I tried to install it:
- name: Install locales package
become: yes
yum:
name: locales
state: present
Both Ansible and manual install using sudo yum install locales
doesn’t work. I also tried enabling the EPEL repo without success.
How can I make sure that the requestes languages are present on the target system?
2
Answers
There is an open bug report since Aug 27 2018 for centos support. I suggest you vote for it so we get a chance it climbs up the priority list (or submit a PR if you have the required skills and enough time)
Until this is fixed, you can probably apply the workarround proposed by @wojciech-kopras on april 2019 adapted below from your question (tested successfully against a docker
centos:7
container):Also, for some added context there’s no package named
locales
which is why original task for yum is failing. The package name containing locale data isglibc-common
(at least on RHEL/CentOS 7, should be the same for 8). However, as noted by the first commenter, there appears to be a bug.