From: Ismaƫl Bouya Date: Sun, 18 Feb 2018 10:38:10 +0000 (+0100) Subject: Refresh hostname after modification X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FPuppet.git;a=commitdiff_plain;h=f17c2d0b1679b41a6e80ef921645ab65b6257548 Refresh hostname after modification --- diff --git a/modules/base_installation/manifests/system_config.pp b/modules/base_installation/manifests/system_config.pp index f3325f4..25bfe0f 100644 --- a/modules/base_installation/manifests/system_config.pp +++ b/modules/base_installation/manifests/system_config.pp @@ -11,8 +11,15 @@ class base_installation::system_config inherits base_installation { content => "$base_installation::system_hostname\n", } + exec { "set_hostname": + command => "/usr/bin/hostnamectl set-hostname $base_installation::system_hostname", + refreshonly => true, + subscribe => File["/etc/hostname"], + returns => [0, 1], + } + # TODO: find a way to ensure that /etc/hostname doesn't change - # exec { "set_hostname": + # exec { "set_hostname_firstboot": # command => "/usr/bin/systemd-firstboot --hostname=$base_installation::system_hostname", # creates => "/etc/hostname", # }