X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fbase_installation%2Fmanifests%2Fsystem_config.pp;h=c6da26b159714f369db463bdbfb7c72c1219c509;hb=433e9279d165bf225c597834b5a7c7ae64c11a27;hp=25bfe0f944d4517de45344af9c2c95e26e083d01;hpb=f17c2d0b1679b41a6e80ef921645ab65b6257548;p=perso%2FImmae%2FProjets%2FPuppet.git diff --git a/modules/base_installation/manifests/system_config.pp b/modules/base_installation/manifests/system_config.pp index 25bfe0f..c6da26b 100644 --- a/modules/base_installation/manifests/system_config.pp +++ b/modules/base_installation/manifests/system_config.pp @@ -6,23 +6,21 @@ class base_installation::system_config inherits base_installation { } } - unless empty($base_installation::system_hostname) { - file { '/etc/hostname': - content => "$base_installation::system_hostname\n", - } + if empty($base_installation::system_hostname) { + $hostname = $base_installation::real_hostname + } else { + $hostname = $base_installation::system_hostname + } - exec { "set_hostname": - command => "/usr/bin/hostnamectl set-hostname $base_installation::system_hostname", - refreshonly => true, - subscribe => File["/etc/hostname"], - returns => [0, 1], - } + file { '/etc/hostname': + content => "$hostname\n", + } - # TODO: find a way to ensure that /etc/hostname doesn't change - # exec { "set_hostname_firstboot": - # command => "/usr/bin/systemd-firstboot --hostname=$base_installation::system_hostname", - # creates => "/etc/hostname", - # } + exec { "set_hostname": + command => "/usr/bin/hostnamectl set-hostname $hostname", + refreshonly => true, + subscribe => File["/etc/hostname"], + returns => [0, 1], } }