Puppet Class: named::service
- Defined in:
- manifests/service.pp
Summary
A helper class that serves to control the named service and has beenOverview
isolated to make the overall logic more understandable.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'manifests/service.pp', line 12
class named::service (
Boolean $chroot = true,
Stdlib::Absolutepath $chroot_path = $named::chroot_path,
) {
assert_private()
if $chroot {
if $facts['os']['family'] == 'RedHat' {
if (versioncmp($facts['os']['release']['major'],'7') < 0) {
$svcname = 'named'
}
else {
$svcname = 'named-chroot'
}
}
else {
fail("The named::service class does not yet support ${facts['os']['name']}")
}
}
else {
$svcname = 'named'
}
# Work-around for https://bugzilla.redhat.com/show_bug.cgi?id=1278082
if $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'],'7') >= 0 {
# Override with a full replacement file, as we are changing the
# Unit Requires and After lists and changing the Service Type
# from forking to the default (simple).
file { '/etc/systemd/system/named-chroot.service':
ensure => 'file',
content => template('named/named-chroot.service.erb'),
owner => 'root',
group => 'root',
mode => '0644',
notify => Service[$svcname]
}
exec { 'named-systemctl-daemon-reload':
command => 'systemctl daemon-reload',
refreshonly => true,
path => '/bin:/usr/bin:/usr/local/bin',
before => Service[$svcname]
}
}
service { $svcname:
ensure => 'running',
enable => true,
hasstatus => true,
hasrestart => true
}
}
|