-
-
Notifications
You must be signed in to change notification settings - Fork 272
/
init.pp
75 lines (68 loc) · 2.1 KB
/
init.pp
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
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
75
#
class collectd(
$fqdnlookup = true,
$collectd_hostname = $::hostname,
$interval = 10,
$include = [],
$purge = undef,
$purge_config = false,
$recurse = undef,
$threads = 5,
$timeout = 2,
$typesdb = [],
$write_queue_limit_high = undef,
$write_queue_limit_low = undef,
$package_name = $collectd::params::package,
$version = installed,
) inherits collectd::params {
$plugin_conf_dir = $collectd::params::plugin_conf_dir
validate_bool($purge_config, $fqdnlookup)
validate_array($include, $typesdb)
package { $package_name:
ensure => $version,
name => $package_name,
provider => $collectd::params::provider,
before => File['collectd.conf', 'collectd.d'],
}
file { 'collectd.d':
ensure => directory,
path => $collectd::params::plugin_conf_dir,
mode => '0750',
owner => 'root',
group => $collectd::params::root_group,
purge => $purge,
recurse => $recurse,
notify => Service['collectd'],
}
$conf_content = $purge_config ? {
true => template('collectd/collectd.conf.erb'),
default => undef,
}
file { 'collectd.conf':
path => $collectd::params::config_file,
content => $conf_content,
notify => Service['collectd'],
}
if $purge_config != true {
# former include of conf_d directory
file_line { 'include_conf_d':
ensure => absent,
line => "Include \"${collectd::params::plugin_conf_dir}/\"",
path => $collectd::params::config_file,
notify => Service['collectd'],
}
# include (conf_d directory)/*.conf
file_line { 'include_conf_d_dot_conf':
ensure => present,
line => "Include \"${collectd::params::plugin_conf_dir}/*.conf\"",
path => $collectd::params::config_file,
notify => Service['collectd'],
}
}
service { 'collectd':
ensure => running,
name => $collectd::params::service_name,
enable => true,
require => Package[$package_name],
}
}