2017-08-29 06:51:06 +00:00
|
|
|
---
|
|
|
|
- name: Check current locale
|
|
|
|
shell: localectl
|
|
|
|
register: locale_test
|
2017-09-05 05:26:48 +00:00
|
|
|
when: ansible_distribution == 'Centos' or ansible_distribution == 'Ubuntu'
|
2017-08-29 06:51:06 +00:00
|
|
|
|
|
|
|
- name: Set Locale
|
|
|
|
command: "localectl set-locale LANG={{ locale_lang }}"
|
2017-09-05 05:26:48 +00:00
|
|
|
when: (ansible_distribution == 'Centos' or ansible_distribution == 'Ubuntu') and locale_test.stdout.find('LANG={{ locale_lang }}') == -1
|
2017-08-29 06:51:06 +00:00
|
|
|
|
|
|
|
- name: Set keymap
|
|
|
|
command: "localectl set-keymap {{ locale_keymap }}"
|
2017-09-05 05:26:48 +00:00
|
|
|
when: "(ansible_distribution == 'Centos' or ansible_distribution == 'Ubuntu') and locale_test.stdout.find('Keymap: {{locale_keymap}}') == -1"
|
2017-08-29 06:51:06 +00:00
|
|
|
|
|
|
|
- name: Set Locale as en_US
|
|
|
|
lineinfile: dest=/etc/environment backup=yes line="{{ item }}"
|
|
|
|
with_items:
|
|
|
|
- "LC_ALL=en_US.UTF-8"
|
|
|
|
- "LC_CTYPE=en_US.UTF-8"
|
|
|
|
- "LANG=en_US.UTF-8"
|