generate and set locale

main
Simeon Keske 5 years ago
parent 5ecf6d06b7
commit e0771d212b
No known key found for this signature in database
GPG Key ID: B15B623C3C45B235

@ -2,3 +2,5 @@
users: users:
- { name: 'user', state: 'present', public_key: '' } - { name: 'user', state: 'present', public_key: '' }
- { name: 'nouser', state: 'absent', public_key: '' } - { name: 'nouser', state: 'absent', public_key: '' }
system_locale: en_US.UTF-8

@ -0,0 +1,17 @@
- name: Ensure localisation files for '{{ system_locale }}' are available
locale_gen:
name: "{{ system_locale }}"
state: present
- name: Get current locale and language configuration
command: localectl status
register: locale_status
changed_when: false
- name: Parse 'LANG' from current locale and language configuration
set_fact:
locale_lang: "{{ locale_status.stdout | regex_search('LANG=([^\n]+)', '\\1') | first }}"
- name: Configure locale to '{{ system_locale }}'
command: localectl set-locale LANG={{ system_locale }}
changed_when: locale_lang != system_locale

@ -1,7 +1,9 @@
--- ---
- import_tasks: packages.yml - include: packages.yml
- include: locale.yml
- include: sudo.yml - include: sudo.yml
- include: molly-guard.yml - include: molly-guard.yml
- include: sshd.yml
- include: user.yml user={{ users }} - include: user.yml user={{ users }}
tags: user tags: user
@ -14,5 +16,3 @@
group: root group: root
mode: 0644 mode: 0644
when: motd_path is defined when: motd_path is defined
- include: sshd.yml

@ -28,5 +28,7 @@
- python3-setuptools - python3-setuptools
- rsync - rsync
- gnupg - gnupg
- sudo
- curl
state: present state: present
tags: packages tags: packages

Loading…
Cancel
Save