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
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'manifests/pmie.pp', line 28
define pcp::pmie (
Enum['present', 'absent'] $ensure = 'present',
String $hostname = 'LOCALHOSTNAME',
Boolean $primary = false,
Boolean $socks = false,
String $log_file = 'PCP_LOG_DIR/pmie/LOCALHOSTNAME/pmie.log',
String $args = '', # lint:ignore:params_empty_string_assignment
Optional[Stdlib::Absolutepath] $config_path = undef,
Optional[String] $config_content = undef,
Optional[String] $config_source = undef,
) {
include pcp
Class['pcp::install'] -> Pcp::Pmie[$title]
if $primary {
$_primary = 'y'
} else {
$_primary = 'n'
}
if $socks {
$_socks = 'y'
} else {
$_socks = 'n'
}
if $config_path {
$_args = "${args} -c ${config_path}"
} else {
$_args = $args
}
$_pmie_config_path = "/etc/pcp/pmie/control.d/${name}"
$_line = "#This file is managed by Puppet\n${hostname} ${_primary} ${_socks} ${log_file} ${_args}\n"
file { "pmie-${name}":
ensure => $ensure,
path => $_pmie_config_path,
owner => 'root',
group => 'root',
mode => '0644',
content => $_line,
notify => Service['pmie'],
}
if $config_path {
file { "pmie-${name}-config":
ensure => $ensure,
path => $config_path,
owner => 'root',
group => 'root',
mode => '0644',
content => $config_content,
source => $config_source,
notify => Service['pmie'],
before => File["pmie-${name}"],
}
}
}
|