From 7a482e195fb35a615dfdf6e7efc810451ea56aa0 Mon Sep 17 00:00:00 2001 From: Tobias Hachmer Date: Sun, 12 Nov 2017 12:44:20 +0100 Subject: [PATCH] Role server-basic: add locale setting --- roles/server-basic/README.md | 4 +++- roles/server-basic/tasks/main.yml | 9 +++++++++ roles/server-basic/vars/main.yml | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/roles/server-basic/README.md b/roles/server-basic/README.md index ebb8121..d454a25 100644 --- a/roles/server-basic/README.md +++ b/roles/server-basic/README.md @@ -3,9 +3,11 @@ Diese Ansible role installiert Pakete, die auf allen MWU-Server benötigt werden. - installiert Pakete, die auf allen Servern benötigt werden -- setzt als default Editor +- setzt vim als default Editor - setzt die Zeitzone auf Europe/Berlin +- generiert und setzt default locale ## Benötigte Variablen - Liste `packages` (Rollen Variable) +- Variable `default_locale` (Rollen-Variable) diff --git a/roles/server-basic/tasks/main.yml b/roles/server-basic/tasks/main.yml index 1de5f78..e14a925 100644 --- a/roles/server-basic/tasks/main.yml +++ b/roles/server-basic/tasks/main.yml @@ -10,6 +10,15 @@ name: editor path: /usr/bin/vim.basic +- name: ensure default locale is installed + locale_gen: + name: "{{ default_locale }}" + state: present + +- name: ensure default locale is set + command: "/usr/bin/localectl set-locale LANG={{ default_locale }}" + changed_when: false + - name: set timezone to Europe/Berlin timezone: name: Europe/Berlin diff --git a/roles/server-basic/vars/main.yml b/roles/server-basic/vars/main.yml index 68bc696..722d395 100644 --- a/roles/server-basic/vars/main.yml +++ b/roles/server-basic/vars/main.yml @@ -11,3 +11,5 @@ packages: - sudo - sysfsutils - vim + +default_locale: "en_US.UTF-8"