munin: Make source optional for munin::plugin to allow deploying just configurations
This commit is contained in:
parent
05ac584cbf
commit
21f4caa533
1 changed files with 29 additions and 32 deletions
|
@ -135,7 +135,7 @@ define munin::snmpnode($snmp_community="public", $snmp_version="2") {
|
|||
}
|
||||
|
||||
|
||||
# Add new custom munin plugin.
|
||||
# Add new munin plugin or plugin configuration.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
|
@ -144,9 +144,9 @@ define munin::snmpnode($snmp_community="public", $snmp_version="2") {
|
|||
# $enable:
|
||||
# Set to false to disable plugin.
|
||||
# $source:
|
||||
# Source path for the plugin.
|
||||
# Source path of the plugin.
|
||||
# $config:
|
||||
# Source path of plugin configuration file. Defaults to none.
|
||||
# Source path of plugin configuration file.
|
||||
#
|
||||
# === Sample usage
|
||||
#
|
||||
|
@ -158,10 +158,6 @@ define munin::snmpnode($snmp_community="public", $snmp_version="2") {
|
|||
define munin::plugin($enable=true, $source=undef, $config=undef) {
|
||||
|
||||
if $enable == true {
|
||||
if ! $source {
|
||||
fail("Must define source parameter for Munin::Plugin[${name}]")
|
||||
}
|
||||
|
||||
case $::operatingsystem {
|
||||
"openbsd": {
|
||||
$plugindir = "/usr/local/libexec/munin/plugins"
|
||||
|
@ -171,33 +167,34 @@ define munin::plugin($enable=true, $source=undef, $config=undef) {
|
|||
}
|
||||
}
|
||||
|
||||
file { "${plugindir}/${name}":
|
||||
ensure => present,
|
||||
mode => "0755",
|
||||
owner => "root",
|
||||
group => $::operatingsystem ? {
|
||||
"openbsd" => "wheel",
|
||||
default => "root",
|
||||
},
|
||||
source => $source,
|
||||
notify => Exec["munin-node-configure"],
|
||||
require => Package["munin-node"],
|
||||
if $source {
|
||||
file { "${plugindir}/${name}":
|
||||
ensure => present,
|
||||
mode => "0755",
|
||||
owner => "root",
|
||||
group => $::operatingsystem ? {
|
||||
"openbsd" => "wheel",
|
||||
default => "root",
|
||||
},
|
||||
source => $source,
|
||||
notify => Exec["munin-node-configure"],
|
||||
require => Package["munin-node"],
|
||||
}
|
||||
}
|
||||
|
||||
file { "/etc/munin/plugin-conf.d/${name}":
|
||||
ensure => $config ? {
|
||||
undef => absent,
|
||||
default => present,
|
||||
},
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => $::operatingsystem ? {
|
||||
"openbsd" => "wheel",
|
||||
default => "root",
|
||||
},
|
||||
source => $config,
|
||||
notify => Exec["munin-node-configure"],
|
||||
require => Package["munin-node"],
|
||||
if $config {
|
||||
file { "/etc/munin/plugin-conf.d/${name}":
|
||||
ensure => present,
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => $::operatingsystem ? {
|
||||
"openbsd" => "wheel",
|
||||
default => "root",
|
||||
},
|
||||
source => $config,
|
||||
notify => Exec["munin-node-configure"],
|
||||
require => Package["munin-node"],
|
||||
}
|
||||
}
|
||||
} else {
|
||||
file { "/etc/munin/plugin-conf.d/${name}":
|
||||
|
|
Loading…
Add table
Reference in a new issue