X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fbase_installation%2Fmanifests%2Fsystem_config.pp;h=c6da26b159714f369db463bdbfb7c72c1219c509;hb=5d110ba1a1e8b2e0e7ab2cb0499940df86aebad3;hp=f3325f4bb37bf7935a2e8432d7b7552817a02fd8;hpb=7fed35a408b9ec37454169425823785b5fc8978b;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 f3325f4..c6da26b 100644 --- a/modules/base_installation/manifests/system_config.pp +++ b/modules/base_installation/manifests/system_config.pp @@ -6,16 +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 + } + + file { '/etc/hostname': + content => "$hostname\n", + } - # TODO: find a way to ensure that /etc/hostname doesn't change - # exec { "set_hostname": - # 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], } }