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
|
# File 'manifests/service.pp', line 1
class suricata::service {
case $::suricata::service_provider {
'systemd': {
$systemd_path = $::operatingsystem ? {
/(Ubuntu|Debian)/ => '/lib/systemd/system',
default => '/usr/lib/systemd/system',
}
$service_require = File["${systemd_path}/suricata.service"]
file { "${systemd_path}/suricata.service":
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
content => epp('suricata/suricata.service.epp'),
}
exec { 'Daemon-reload':
command => '/bin/systemctl daemon-reload',
subscribe => File["${systemd_path}/suricata.service"],
refreshonly => true,
notify => Service[$::suricata::service_name],
}
}
default: {
$service_require = undef
notice("Your ${::suricata::service_provider} is not supported")
}
}
service { $::suricata::service_name:
ensure => $::suricata::service_ensure,
enable => $::suricata::service_enable,
provider => $::suricata::service_provider,
require => $service_require,
}
}
|