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
|
# File 'manifests/network/hostname.pp', line 1
class g_server::network::hostname(
$hostname
){
case $::osfamily {
'Gentoo': {
ensure_resource('service', 'hostname', {
'ensure' => 'running',
'enable' => true
})
file { '/etc/conf.d/hostname':
content => "# Set to the hostname of this machine\nhostname=\"${hostname}\"\n",
}
~>Service['hostname']
}
default: {
ensure_packages(['hostname'], { ensure => 'present' })
file { '/etc/hostname':
content => "${hostname}\n",
}
~> exec { 'g_server update hostname':
command => 'hostname -F /etc/hostname',
path => ['/bin', '/usr/bin', '/usr/local/bin'],
refreshonly => true,
require => Package['hostname']
}
}
}
}
|