summaryrefslogtreecommitdiff
path: root/puppet/modules/site_config/manifests/hosts.pp
blob: 1e1590f580c7bd820340322db218285b5f894340 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class site_config::hosts() {
  $hosts = hiera('hosts','')
  $hostname = hiera('name')
  $domain_hash = hiera('domain')
  $domain_public = $domain_hash['full_suffix']

  file { "/etc/hostname":
    ensure => present,
    content => $hostname
  }

  exec { "/bin/hostname ${hostname}":
    subscribe   => [ File['/etc/hostname'], File['/etc/hosts'] ],
    refreshonly => true;
  }

  file { '/etc/hosts':
    content => template('site_config/hosts'),
    mode    => '0644', owner => root, group => root;
  }
}