summaryrefslogtreecommitdiff
path: root/manifests/common.pp
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-01-04 02:53:57 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-01-04 02:57:31 +0100
commit17bed912df24997f39552927835a61177365aa72 (patch)
treec7037f714e98d51db8cd34d184e70f2e4032ad84 /manifests/common.pp
parentRemaining stuff on gandalf. (diff)
downloadprofiles-17bed912df24997f39552927835a61177365aa72.tar.gz
profiles-17bed912df24997f39552927835a61177365aa72.tar.xz
changes
Diffstat (limited to 'manifests/common.pp')
-rw-r--r--manifests/common.pp37
1 files changed, 36 insertions, 1 deletions
diff --git a/manifests/common.pp b/manifests/common.pp
index dc63951..4cb5226 100644
--- a/manifests/common.pp
+++ b/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
+ }
+
}