ansible-role-basic-system-s.../tasks/locale.yml

37 lines
1.3 KiB
YAML

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