From 7f6c36daafb2157e4f47e770383f1d86d3dc4a01 Mon Sep 17 00:00:00 2001 From: Jeltz Date: Mon, 13 Dec 2021 02:16:13 +0100 Subject: [PATCH] Create a separate 'locales' roles (+ en_US) --- playbooks/base.yml | 8 ++++++-- .../tasks/apt-listchanges.yml | 0 .../tasks/apt-unattended.yml | 0 .../{baseconfig => debian_common}/tasks/main.yml | 15 --------------- .../templates/apt/20auto-upgrades.j2 | 0 .../templates/apt/50unattended-upgrades.j2 | 0 .../templates/apt/sources.list.j2 | 0 .../templates/resolv.conf | 0 roles/locales/defaults/main.yml | 4 ++++ roles/{baseconfig => locales}/handlers/main.yml | 2 +- roles/locales/tasks/main.yml | 15 +++++++++++++++ 11 files changed, 26 insertions(+), 18 deletions(-) rename roles/{baseconfig => debian_common}/tasks/apt-listchanges.yml (100%) rename roles/{baseconfig => debian_common}/tasks/apt-unattended.yml (100%) rename roles/{baseconfig => debian_common}/tasks/main.yml (84%) rename roles/{baseconfig => debian_common}/templates/apt/20auto-upgrades.j2 (100%) rename roles/{baseconfig => debian_common}/templates/apt/50unattended-upgrades.j2 (100%) rename roles/{baseconfig => debian_common}/templates/apt/sources.list.j2 (100%) rename roles/{baseconfig => debian_common}/templates/resolv.conf (100%) create mode 100644 roles/locales/defaults/main.yml rename roles/{baseconfig => locales}/handlers/main.yml (68%) create mode 100644 roles/locales/tasks/main.yml diff --git a/playbooks/base.yml b/playbooks/base.yml index 6126147..4b8559e 100755 --- a/playbooks/base.yml +++ b/playbooks/base.yml @@ -2,9 +2,13 @@ --- # Put a common configuration on all servers - hosts: all,!unifi + vars: + locales_default: en_US.UTF-8 + locales_additional: + - fr_FR.UTF-8 roles: - - baseconfig + - debian_common + - locales - basesecurity - - ldap_client - logrotate - update_motd diff --git a/roles/baseconfig/tasks/apt-listchanges.yml b/roles/debian_common/tasks/apt-listchanges.yml similarity index 100% rename from roles/baseconfig/tasks/apt-listchanges.yml rename to roles/debian_common/tasks/apt-listchanges.yml diff --git a/roles/baseconfig/tasks/apt-unattended.yml b/roles/debian_common/tasks/apt-unattended.yml similarity index 100% rename from roles/baseconfig/tasks/apt-unattended.yml rename to roles/debian_common/tasks/apt-unattended.yml diff --git a/roles/baseconfig/tasks/main.yml b/roles/debian_common/tasks/main.yml similarity index 84% rename from roles/baseconfig/tasks/main.yml rename to roles/debian_common/tasks/main.yml index 0915ca2..31fcd25 100644 --- a/roles/baseconfig/tasks/main.yml +++ b/roles/debian_common/tasks/main.yml @@ -39,21 +39,6 @@ dest: /etc/apt/sources.list mode: 0644 -# Patriotisme -- name: Ensure French UTF-8 locale exists - locale_gen: - name: fr_FR.UTF-8 - state: present - -# Fix LC_CTYPE="C" -- name: Select default locale - debconf: - name: locales - question: locales/default_environment_locale - value: fr_FR.UTF-8 - vtype: select - notify: Reconfigure locales - # APT-List Changes : send email with changelog - include_tasks: apt-listchanges.yml diff --git a/roles/baseconfig/templates/apt/20auto-upgrades.j2 b/roles/debian_common/templates/apt/20auto-upgrades.j2 similarity index 100% rename from roles/baseconfig/templates/apt/20auto-upgrades.j2 rename to roles/debian_common/templates/apt/20auto-upgrades.j2 diff --git a/roles/baseconfig/templates/apt/50unattended-upgrades.j2 b/roles/debian_common/templates/apt/50unattended-upgrades.j2 similarity index 100% rename from roles/baseconfig/templates/apt/50unattended-upgrades.j2 rename to roles/debian_common/templates/apt/50unattended-upgrades.j2 diff --git a/roles/baseconfig/templates/apt/sources.list.j2 b/roles/debian_common/templates/apt/sources.list.j2 similarity index 100% rename from roles/baseconfig/templates/apt/sources.list.j2 rename to roles/debian_common/templates/apt/sources.list.j2 diff --git a/roles/baseconfig/templates/resolv.conf b/roles/debian_common/templates/resolv.conf similarity index 100% rename from roles/baseconfig/templates/resolv.conf rename to roles/debian_common/templates/resolv.conf diff --git a/roles/locales/defaults/main.yml b/roles/locales/defaults/main.yml new file mode 100644 index 0000000..4e50c21 --- /dev/null +++ b/roles/locales/defaults/main.yml @@ -0,0 +1,4 @@ +--- +locales_default: en_US.UTF-8 +locales_additional: [] +... diff --git a/roles/baseconfig/handlers/main.yml b/roles/locales/handlers/main.yml similarity index 68% rename from roles/baseconfig/handlers/main.yml rename to roles/locales/handlers/main.yml index 66c2de1..318ed33 100644 --- a/roles/baseconfig/handlers/main.yml +++ b/roles/locales/handlers/main.yml @@ -1,4 +1,4 @@ --- -# Reconfigure locales when conf changes - name: Reconfigure locales command: dpkg-reconfigure locales -f noninteractive +... diff --git a/roles/locales/tasks/main.yml b/roles/locales/tasks/main.yml new file mode 100644 index 0000000..488d9eb --- /dev/null +++ b/roles/locales/tasks/main.yml @@ -0,0 +1,15 @@ +--- +- name: Install locales + locale_gen: + name: "{{ item }}" + state: present + loop: "{{ [locales_default] + locales_additional }}" + +- name: Select default locale + debconf: + name: locales + question: locales/default_environment_locale + value: "{{ locales_default }}" + vtype: select + notify: Reconfigure locales +...