ansible-role-os-bootstrap/tasks/locale.yml

43 lines
1.5 KiB
YAML

---
- name: locale | Generate locales and set the default locale on Debian and Ubuntu distributions
block:
- name: locale | Add/remove a list of locales
community.general.locale_gen:
name: "{{ item.name }}"
state: "{{ item.state | default('present') }}"
loop: "{{ locales_list }}"
- name: locale | Set the default locale on Trusty
ansible.builtin.shell: update-locale LANG={{ default_locale_lang }}
when: ansible_distribution_release == "trusty"
changed_when: false
when: ansible_distribution_file_variety == "Debian"
tags: [systemsetup, locale]
- name: locale | Set the locale on distributions that run systemd
block:
- name: locale | Check if localectl exists
ansible.builtin.stat:
path: /usr/bin/localectl
register: localectl_executable
- name: locale | Set the default locale
ansible.builtin.command: localectl set-locale 'LANG={{ default_locale_lang }}' 'LC_MESSAGES={{ default_deb_locale_messages }}'
when:
- localectl_executable.stat.exists | bool
- ansible_distribution_file_variety == "Debian"
changed_when: false
- name: locale | Set the default locale
ansible.builtin.command: localectl set-locale "{{ item }}"
loop:
- LANG={{ default_locale_lang }}
- LC_MESSAGES={{ default_el_locale_messages }}
when:
- localectl_executable.stat.exists | bool
- ansible_distribution_file_variety == "RedHat"
changed_when: false
tags: [systemsetup, locale]