community.general.locale_gen module – Creates or removes locales
Note
This module is part of the community.general collection (version 10.2.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.locale_gen
.
Synopsis
Manages locales in Debian and Ubuntu systems.
Parameters
Parameter |
Comments |
---|---|
Name and encoding of the locales, such as Before community.general 9.3.0, this was a string. Using a string still works. |
|
Whether the locales shall be present. Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Notes
Note
If
/etc/locale.gen
exists, the module will assume to be using the glibc mechanism, else if/var/lib/locales/supported.d/
exists it will assume to be using the ubuntu_legacy mechanism, else it will raise an error.When using glibc mechanism, it will manage locales by editing
/etc/locale.gen
and runninglocale-gen
.When using ubuntu_legacy mechanism, it will manage locales by editing
/var/lib/locales/supported.d/local
and then runninglocale-gen
.Please note that the code path that uses ubuntu_legacy mechanism has not been tested for a while, because Ubuntu is already using the glibc mechanism. There is no support for that, given our inability to test it. Therefore, that mechanism is deprecated and will be removed in community.general 13.0.0.
Currently the module is only supported for Debian and Ubuntu systems.
This module requires the package
locales
installed in Debian and Ubuntu systems.
Examples
- name: Ensure a locale exists
community.general.locale_gen:
name: de_CH.UTF-8
state: present
- name: Ensure multiple locales exist
community.general.locale_gen:
name:
- en_GB.UTF-8
- nl_NL.UTF-8
state: present
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Mechanism used to deploy the locales. Returned: success Can only return:
Sample: |