add locale role

This commit is contained in:
uumas
2022-05-12 00:50:00 +03:00
parent 064e270ce4
commit e8e88e50a1
5 changed files with 46 additions and 0 deletions

13
docs/locale.md Normal file
View File

@@ -0,0 +1,13 @@
Generates loacles defined in `gen_locales`, sets `LANG`, `LC_MESSAGES`, and `LANGUAGE` to the values of
`lang`, `lc_messages` and `language` respectively. These have the following defaults:
```
gen_locales:
- en_US.UTF-8
- en_GB.UTF-8
lang: en_US.UTF-8
lc_messages: "{{ lang }}"
language: "en_US:en"
```

1
roles/locale/README.md Normal file
View File

@@ -0,0 +1 @@
Generates and configures locales

View File

@@ -0,0 +1,10 @@
---
gen_locales:
- en_US.UTF-8
- en_GB.UTF-8
lang: en_US.UTF-8
lc_messages: "{{ lang }}"
language: "en_US:en"

View File

@@ -0,0 +1,16 @@
---
- name: Install locales package
package:
name: locales
- name: Generate locales
locale_gen:
name: "{{ item }}"
loop: "{{ gen_locales }}"
- name: Put default locale config in place
template:
src: locale.j2
dest: /etc/default/locale

View File

@@ -0,0 +1,6 @@
# {{ ansible_managed }}
LANG="{{ lang }}"
LC_MESSAGES="{{ lc_messages }}"
LANGUAGE="{{ language }}"