aboutsummaryrefslogtreecommitdiff
path: root/modules/base_installation/manifests/system_config.pp
blob: ccc5dcc8c9931307007adc1f2e0ad4af3c940be0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class base_installation::system_config inherits base_installation {
  unless empty($base_installation::system_timezone) {
    file { "/etc/localtime":
      ensure => "link",
      target => "../usr/share/zoneinfo/$base_installation::system_timezone"
    }
  }

  if empty($base_installation::system_hostname) {
    $hostname = $base_installation::real_hostname
  } else {
    $hostname = $base_installation::system_hostname
  }

  file { '/etc/hostname':
    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_firstboot":
  #   command     => "/usr/bin/systemd-firstboot --hostname=$base_installation::system_hostname",
  #   creates     => "/etc/hostname",
  # }

}