Note
This module is part of the community.general collection (version 10.7.3).
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.
Parameter | Comments |
|---|---|
name list / elements=string / required | Name and encoding of the locales, such as Before community.general 9.3.0, this was a string. Using a string still works. |
state string | Whether the locales shall be present. Choices:
|
Attribute | Support | Description |
|---|---|---|
check_mode | Support: full | Can run in |
diff_mode | Support: none | Will return details on what has changed (or possibly needs changing in |
Note
/etc/locale.gen exists, the module assumes to be using the glibc mechanism, else if /var/lib/locales/supported.d/ exists it assumes to be using the ubuntu_legacy mechanism, else it raises an error./etc/locale.gen and running locale-gen./var/lib/locales/supported.d/local and then running locale-gen.locales installed in Debian and Ubuntu systems.- 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
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
mechanism string added in community.general 10.2.0 | Mechanism used to deploy the locales. Returned: success Can only return:
Sample: |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/locale_gen_module.html