From 4a9463db5f2fbb9427d355823f7666913cdc5650 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 23 Jan 2021 12:05:59 +0100 Subject: [PATCH] bundles/basic: ensure a proper locale is installed --- bundles/{hostname => basic}/files/hosts | 0 bundles/basic/files/locale | 1 + bundles/basic/files/locale.gen | 1 + bundles/{hostname => basic}/files/motd | 0 bundles/basic/items.py | 27 +++++++++++++++++++++++++ bundles/basic/metadata.py | 3 +++ bundles/hostname/items.py | 8 -------- bundles/systemd/items.py | 2 +- groups/os.py | 2 +- 9 files changed, 34 insertions(+), 10 deletions(-) rename bundles/{hostname => basic}/files/hosts (100%) create mode 100644 bundles/basic/files/locale create mode 100644 bundles/basic/files/locale.gen rename bundles/{hostname => basic}/files/motd (100%) create mode 100644 bundles/basic/items.py create mode 100644 bundles/basic/metadata.py delete mode 100644 bundles/hostname/items.py diff --git a/bundles/hostname/files/hosts b/bundles/basic/files/hosts similarity index 100% rename from bundles/hostname/files/hosts rename to bundles/basic/files/hosts diff --git a/bundles/basic/files/locale b/bundles/basic/files/locale new file mode 100644 index 0000000..6ad3e9f --- /dev/null +++ b/bundles/basic/files/locale @@ -0,0 +1 @@ +LANG=${node.metadata['locale']} diff --git a/bundles/basic/files/locale.gen b/bundles/basic/files/locale.gen new file mode 100644 index 0000000..e2802b9 --- /dev/null +++ b/bundles/basic/files/locale.gen @@ -0,0 +1 @@ +${node.metadata['locale']} diff --git a/bundles/hostname/files/motd b/bundles/basic/files/motd similarity index 100% rename from bundles/hostname/files/motd rename to bundles/basic/files/motd diff --git a/bundles/basic/items.py b/bundles/basic/items.py new file mode 100644 index 0000000..fdb803e --- /dev/null +++ b/bundles/basic/items.py @@ -0,0 +1,27 @@ +# TODO support non-systemd systems + +files = { + '/etc/default/locale': { + 'content_type': 'mako', + 'triggers': { + 'action:locale-gen', + }, + }, + '/etc/hosts': { + 'content_type': 'mako', + }, + '/etc/locale.gen': { + 'content_type': 'mako', + 'triggers': { + 'action:locale-gen', + }, + }, + '/etc/motd': {}, +} + +actions = { + 'locale-gen': { + 'triggered': True, + 'command': 'locale-gen', + }, +} diff --git a/bundles/basic/metadata.py b/bundles/basic/metadata.py new file mode 100644 index 0000000..63a756e --- /dev/null +++ b/bundles/basic/metadata.py @@ -0,0 +1,3 @@ +defaults = { + 'locale': 'en_US.UTF-8', +} diff --git a/bundles/hostname/items.py b/bundles/hostname/items.py deleted file mode 100644 index eae7081..0000000 --- a/bundles/hostname/items.py +++ /dev/null @@ -1,8 +0,0 @@ -# TODO support non-systemd systems - -files = { - '/etc/hosts': { - 'content_type': 'mako', - }, - '/etc/motd': {}, -} diff --git a/bundles/systemd/items.py b/bundles/systemd/items.py index b8f6436..0365bce 100644 --- a/bundles/systemd/items.py +++ b/bundles/systemd/items.py @@ -10,7 +10,7 @@ actions = { 'systemd-hostname': { 'command': 'hostnamectl set-hostname {}'.format(node.metadata['hostname']), 'unless': '[ "$(hostnamectl --static)" = "{}" ]'.format(node.metadata['hostname']), - # Provided by 'hostname' bundle + # Provided by bundle:basic 'needs': { 'file:/etc/hosts', }, diff --git a/groups/os.py b/groups/os.py index 30a17a8..85f794b 100644 --- a/groups/os.py +++ b/groups/os.py @@ -19,8 +19,8 @@ groups['linux'] = { 'bundles': { 'apt', 'backup-client', + 'basic', 'cron', - 'hostname', 'openssh', 'postfix', 'sshmon',