aboutsummaryrefslogtreecommitdiff
path: root/modules/base_installation/manifests/system_config.pp
blob: 25bfe0f944d4517de45344af9c2c95e26e083d01 (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
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"
    }
  }

  unless empty($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",
    # }
  }

}