Puppet Class: conntrackd::service
- Defined in:
- manifests/service.pp
Summary
This class exists to coordinate all service management related actions,Overview
# conntrackd::service
functionality and logical units in a central place.
Note: “service” is the Puppet term and type for background processes in general and is used in a platform-independent way. E.g. “service” means “daemon” in relation to Unix-like systems.
This class may be imported by other classes to use its functionality:
class { 'conntrackd::service': }
It is not intended to be used directly by external resources like node definitions or other modules.
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 65 66 67 68 69 70 71 72 73 74 |
# File 'manifests/service.pp', line 20
class conntrackd::service {
assert_private()
#### Service management
if $conntrackd::ensure == 'present' {
# set params: in operation
case $conntrackd::status {
# make sure service is currently running, start it on boot
'enabled': {
$service_ensure = 'running'
$service_enable = true
}
# make sure service is currently stopped, do not start it on boot
'disabled': {
$service_ensure = 'stopped'
$service_enable = false
}
# make sure service is currently running, do not start it on boot
'running': {
$service_ensure = 'running'
$service_enable = false
}
# do not start service on boot, do not manage service
'unmanaged': {
$service_ensure = undef
$service_enable = false
}
# unknown status
# note: don't forget to update the parameter check in init.pp if you
# add a new or change an existing status.
default: {
fail("\"${conntrackd::status}\" is an unknown service status value")
}
}
} else {
# set params: removal
# make sure the service is stopped and disabled (the removal itself will be
# done by package.pp)
$service_ensure = 'stopped'
$service_enable = false
}
# action
service { 'conntrackd':
ensure => $service_ensure,
enable => $service_enable,
name => $conntrackd::service_name,
hasstatus => $conntrackd::service_hasstatus,
hasrestart => $conntrackd::service_hasrestart,
pattern => $conntrackd::service_pattern,
status => $conntrackd::service_status,
}
}
|