From 43f21715007319b6fac3c417fe5a9985c4246d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 4 Jan 2022 02:53:57 +0100 Subject: changes --- modules/profiles/manifests/common.pp | 37 ++++++++++++++++++++++++++++++- modules/profiles/manifests/workstation.pp | 36 ++---------------------------- 2 files changed, 38 insertions(+), 35 deletions(-) (limited to 'modules/profiles/manifests') diff --git a/modules/profiles/manifests/common.pp b/modules/profiles/manifests/common.pp index dc63951..4cb5226 100644 --- a/modules/profiles/manifests/common.pp +++ b/modules/profiles/manifests/common.pp @@ -1,8 +1,43 @@ -class profiles::common { +class profiles::common ( + String $timezone, + Array[String] $locales = [ 'en_US.UTF-8', ], +) { file_line { 'hosts ourself': ensure => present, line => "::1\t${facts['name']}\t${::fqdn}", path => '/etc/hosts', } + + file { '/etc/localtime': + ensure => link, + target => "/usr/share/zoneinfo/${timezone}", + } + + # TODO possibly check in /usr/share/i18n/locales if file exists + # there + + $fixed_locales = ($locales.map |$locale| { + if $locale =~ /^[^.]*\.(.*)$/ { + "${locale} ${1}" + } else { + "${locale} UTF-8" + } + } + [ '' ]) + + file { '/etc/locale.gen': + content => $fixed_locales.join("\n") + } ~> exec { 'locale-gen': + path => [ '/bin', '/usr/bin', ], + refreshonly => true, + } + + file { 'Default locales': + path => '/etc/locale.conf', + content => @(EOF) + LANG=en_US.UTF-8 + LC_TIME=sv_SE.UTF-8 + | EOF + } + } diff --git a/modules/profiles/manifests/workstation.pp b/modules/profiles/manifests/workstation.pp index 2e44016..cfc413e 100644 --- a/modules/profiles/manifests/workstation.pp +++ b/modules/profiles/manifests/workstation.pp @@ -1,4 +1,5 @@ -class profiles::workstation { +class profiles::workstation ( +) { $os = $facts['os']['name'].downcase() include "::profiles::workstation::${os}" @@ -111,39 +112,6 @@ class profiles::workstation { | EOF } - $locales = [ - 'en_DK.UTF-8 UTF-8', - 'en_US.UTF-8 UTF-8', - 'en_GB.UTF-8 UTF-8', - 'sv_SE.UTF-8 UTF-8', - 'sv_SE.ISO-8859-1 ISO-8859-1', - '', - ] - - # TODO possibly check in /usr/share/i18n/locales if file exists - # there - - file { '/etc/locale.gen': - content => $locales.join("\n") - } ~> exec { 'locale-gen': - path => [ '/bin', '/usr/bin', ], - refreshonly => true, - } - - file { 'Default locales': - path => '/etc/locale.conf', - content => @(EOF) - LANG=en_US.UTF-8 - LC_TIME=sv_SE.UTF-8 - | EOF - } - - $timezone = 'Europe/Stockholm' - - file { '/etc/localtime': - ensure => link, - target => "/usr/share/zoneinfo/${timezone}", - } systemd_mount { '/usr/net': what => 'elrond:/files', -- cgit v1.2.3