]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
Refresh hostname after modification
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 18 Feb 2018 10:38:10 +0000 (11:38 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 18 Feb 2018 10:47:06 +0000 (11:47 +0100)
modules/base_installation/manifests/system_config.pp

index f3325f4bb37bf7935a2e8432d7b7552817a02fd8..25bfe0f944d4517de45344af9c2c95e26e083d01 100644 (file)
@@ -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",
     # }