Skip to content

Commit

Permalink
locale: add role for managing locale
Browse files Browse the repository at this point in the history
  • Loading branch information
dezeroku committed May 20, 2024
1 parent 5718639 commit 4d71bd5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions playbooks/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
become: true
become_user: root
roles:
- {role: locale, tags: ['locale']}
- {role: pacman, tags: ['pacman']}
- {role: pacoloco, tags: ['pacoloco']}
- {role: ntp, tags: ['ntp']}
Expand Down
5 changes: 5 additions & 0 deletions roles/locale/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
locale_lang: en_US.UTF-8
locale_gen:
- en_US.UTF-8 UTF-8
- pl_PL.UTF-8 UTF-8
5 changes: 5 additions & 0 deletions roles/locale/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Generate locale
changed_when: true
ansible.builtin.command:
cmd: locale-gen
19 changes: 19 additions & 0 deletions roles/locale/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
# community.general.locale_gen gave me mixed results for some reason
# Sticking with the manual generation for now
- name: Ensure locale is enabled
ansible.builtin.lineinfile:
dest: /etc/locale.gen
state: "present"
regexp: "^{{ item }}"
insertafter: "^#{{ item }}"
line: "{{ item }}"
loop: "{{ locale_gen }}"
notify:
- Generate locale

- name: Set locale
ansible.builtin.copy:
content: "LANG={{ locale_lang }}"
dest: /etc/locale.conf
mode: 0644

0 comments on commit 4d71bd5

Please sign in to comment.