add locale role
This commit is contained in:
13
docs/locale.md
Normal file
13
docs/locale.md
Normal 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
1
roles/locale/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Generates and configures locales
|
||||
10
roles/locale/defaults/main.yml
Normal file
10
roles/locale/defaults/main.yml
Normal 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"
|
||||
|
||||
16
roles/locale/tasks/main.yml
Normal file
16
roles/locale/tasks/main.yml
Normal 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
|
||||
|
||||
6
roles/locale/templates/locale.j2
Normal file
6
roles/locale/templates/locale.j2
Normal file
@@ -0,0 +1,6 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
LANG="{{ lang }}"
|
||||
LC_MESSAGES="{{ lc_messages }}"
|
||||
LANGUAGE="{{ language }}"
|
||||
|
||||
Reference in New Issue
Block a user