Puppet Class: check_mk::agent::service
- Defined in:
- manifests/agent/service.pp
Summary
Manages the xinetd serviceOverview
Class: check_mk::agent::service
7 8 9 10 11 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 |
# File 'manifests/agent/service.pp', line 7
class check_mk::agent::service (
Boolean $use_xinetd = $check_mk::agent::use_xinetd,
String $service_name = $check_mk::agent::service_name,
) {
if $use_xinetd {
ensure_packages(['xinetd'])
Package['xinetd'] ~> Service['xinetd']
service { "${service_name}.socket":
ensure => 'stopped',
enable => false,
notify => Service['xinetd'],
}
if ! defined(Service['xinetd']) {
service { 'xinetd':
ensure => 'running',
enable => true,
hasrestart => true,
restart => 'kill -USR2 `pidof xinetd`',
}
}
} else {
if ! defined(Service['xinetd']) {
# We need an xinetd service in the catalog that we can notify to reload,
# but we otherwise don't want to manage the state of xinetd when using
# systemd sockets for check-mk-agent
#
# Note, if the service isn't running, (eg. because it's not even installed)
# puppet will skip trying to do a restart.
# This means we don't have to force the doomed `kill` command to return 0.
service { 'xinetd':
hasrestart => true,
restart => 'kill -USR2 `pidof xinetd` && sleep 1',
}
}
service { "${service_name}.socket":
ensure => 'running',
enable => true,
require => Service['xinetd'],
}
}
}
|