]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blobdiff - modules/base_installation/manifests/system_config.pp
Fetch node informations from LDAP
[perso/Immae/Projets/Puppet.git] / modules / base_installation / manifests / system_config.pp
index 25bfe0f944d4517de45344af9c2c95e26e083d01..ccc5dcc8c9931307007adc1f2e0ad4af3c940be0 100644 (file)
@@ -6,23 +6,27 @@ 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 => "$base_installation::system_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 $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_firstboot":
+  #   command     => "/usr/bin/systemd-firstboot --hostname=$base_installation::system_hostname",
+  #   creates     => "/etc/hostname",
+  # }
+
 }