summaryrefslogtreecommitdiff
path: root/puppet/modules/site_config/manifests/hosts.pp
blob: 83a1040d593db8b71bed98a07eba38e1afb42a9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;
  }
}