feat(role): sets locale for alpine correctly
This commit is contained in:
@@ -1,19 +1,63 @@
|
|||||||
---
|
---
|
||||||
- name: Generate locales
|
- name: Generate locales for Debian-based systems
|
||||||
community.general.locale_gen:
|
community.general.locale_gen:
|
||||||
name:
|
name:
|
||||||
- en_US.UTF-8
|
- en_US.UTF-8
|
||||||
- ru_RU.UTF-8
|
- ru_RU.UTF-8
|
||||||
state: present
|
state: present
|
||||||
|
when: (ansible_facts['distribution'] == "Debian") or
|
||||||
|
(ansible_facts['distribution'] == "Ubuntu")
|
||||||
|
|
||||||
- name: Set locale
|
- name: Set locale for Debian-based systems
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: /etc/locale.conf
|
dest: /etc/locale.conf
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
content: |
|
content: |
|
||||||
LANG=en_US.UTF-8
|
LANG=en_US.UTF-8
|
||||||
LC_ALL=en_US.UTF-8
|
LC_ALL=en_US.UTF-8
|
||||||
|
when: (ansible_facts['distribution'] == "Debian") or
|
||||||
|
(ansible_facts['distribution'] == "Ubuntu")
|
||||||
|
|
||||||
|
# The same for Alpine
|
||||||
|
- name: Install musl-locales package for Alpine
|
||||||
|
community.general.apk:
|
||||||
|
name: musl-locales
|
||||||
|
state: present
|
||||||
|
when: ansible_facts['distribution'] == "Alpine"
|
||||||
|
|
||||||
|
- name: Copy default locale profile to a custom override file for Alpine
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: /etc/profile.d/20locale.sh
|
||||||
|
dest: /etc/profile.d/locale.sh
|
||||||
|
remote_src: true
|
||||||
|
mode: '0644'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
force: false # Do not overwrite if the file already exists
|
||||||
|
when: ansible_facts['distribution'] == "Alpine"
|
||||||
|
|
||||||
|
- name: Set LANG and LC_ALL in the custom locale file for Alpine
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /etc/profile.d/locale.sh
|
||||||
|
regexp: "{{ item.regexp }}"
|
||||||
|
line: "{{ item.line }}"
|
||||||
|
state: present
|
||||||
|
loop:
|
||||||
|
- { regexp: '^export LANG=', line: 'export LANG=en_US.UTF-8' }
|
||||||
|
- { regexp: '^export LC_ALL=', line: 'export LC_ALL=en_US.UTF-8' }
|
||||||
|
when: ansible_facts['distribution'] == "Alpine"
|
||||||
|
|
||||||
|
- name: Ensure Unicode is enabled in /etc/rc.conf for Alpine
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /etc/rc.conf
|
||||||
|
regexp: '^#?unicode='
|
||||||
|
line: 'unicode="YES"'
|
||||||
|
state: present
|
||||||
|
when: ansible_facts['distribution'] == "Alpine"
|
||||||
|
|
||||||
|
|
||||||
|
# Works fine for all
|
||||||
- name: Set time
|
- name: Set time
|
||||||
community.general.timezone:
|
community.general.timezone:
|
||||||
name: Europe/Samara
|
name: Europe/Samara
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user