class profiles::common ( String $timezone = 'UTC', 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}", } if $facts['os']['name'] == 'Debian' { ensure_packages (['locales']) } # 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', '/usr/sbin', ], refreshonly => true, } file { 'Default locales': path => '/etc/locale.conf', content => @(EOF) LANG=en_US.UTF-8 LC_TIME=sv_SE.UTF-8 | EOF } # Min priority, so it can still be overwritten file { '/etc/profile.d/00-terminal-name.sh': source => 'puppet:///modules/profiles/terminal-name.sh', } }