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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
| class services {
define daemons(
$service_ensure,
$service_enable,
$service_require = false
) {
$daemon_provider = $operatingsystem ? { 'OpenSuSE' => 'systemd', 'CentOS' => 'redhat', 'Ubuntu' => 'upstart' }
if $service_require {
Service { require => $daemon_require }
}
service { "$name" :
ensure => $service_ensure,
enable => $service_enable,
provider => $daemon_provider,
}
} #End of daemons
case $operatingsystem {
"OpenSuSE" : {
# OpenSUSE
daemons { 'avahi-daemon' : service_ensure => stopped, service_enable => false }
daemons { 'bluetooth.service' : service_ensure => stopped, service_enable => false }
daemons { 'atd' : service_ensure => running, service_enable => true, service_require => "Package['at']" }
daemons { 'rpcbind' : service_ensure => running, service_enable => true, service_require => "Package['rpcbind']" }
} #End of OpenSuSe
"CentOS" : {
# CentOS
daemons { 'auditd' : service_ensure => stopped, service_enable => false }
daemons { 'mdmonitor' : service_ensure => stopped, service_enable => false }
daemons { 'nscd' : service_ensure => running, service_enable => true, service_require => "Package['nscd']" }
daemons { 'ntpd' : service_ensure => running, service_enable => true, service_require => "Package['ntp']" }
} #End of CentOS
"Ubuntu" : {
# Ubuntu
daemons { 'ypbind' : service_ensure => running, service_enable => true, service_require => "Package['nis']" }
daemons { 'ssh' : service_ensure => running, service_enable => true, service_require => "Package['openssh-server']" }
} # End of Ubuntu
} #End of operatingsystem
} #End of baseos::ervices
|