munin: Add autoconfig parameter for munin::plugin

This commit is contained in:
Ossi Salmi 2014-10-27 13:26:06 +02:00
parent fad562fc8a
commit fc677aae3d

View file

@ -151,6 +151,8 @@ define munin::snmpnode($snmp_community="public", $snmp_version="2") {
# Plugin name to install.
# $enable:
# Set to false to disable plugin.
# $autoconfig:
# Boolean for triggering munin-node-configure. Defaults to true.
# $source:
# Source path of the plugin.
# $config:
@ -163,7 +165,17 @@ define munin::snmpnode($snmp_community="public", $snmp_version="2") {
# config => "puppet:///files/munin/plugins/nagios_multi_.conf",
# }
#
define munin::plugin($enable=true, $source=undef, $config=undef) {
define munin::plugin(
$enable=true,
$autoconfig=true,
$source=undef,
$config=undef,
) {
$notify = $autoconfig ? {
true => Exec["munin-node-configure"],
default => undef,
}
if $enable == true {
case $::operatingsystem {
@ -185,7 +197,7 @@ define munin::plugin($enable=true, $source=undef, $config=undef) {
default => "root",
},
source => $source,
notify => Exec["munin-node-configure"],
notify => $notify,
require => Package["munin-node"],
}
}
@ -200,7 +212,7 @@ define munin::plugin($enable=true, $source=undef, $config=undef) {
default => "root",
},
source => $config,
notify => Exec["munin-node-configure"],
notify => $notify,
require => Package["munin-node"],
}
}
@ -214,7 +226,7 @@ define munin::plugin($enable=true, $source=undef, $config=undef) {
default => "root",
},
content => "[${name}]\ncommand /bin/true\n",
notify => Exec["munin-node-configure"],
notify => $notify,
require => Package["munin-node"],
}
}