summaryrefslogtreecommitdiff
path: root/manifests/plugin/deploy.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/plugin/deploy.pp')
-rw-r--r--manifests/plugin/deploy.pp49
1 files changed, 27 insertions, 22 deletions
diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp
index 0ab4e9f..cbf64fb 100644
--- a/manifests/plugin/deploy.pp
+++ b/manifests/plugin/deploy.pp
@@ -1,39 +1,44 @@
-define munin::plugin::deploy( $source = '', $ensure = 'present', $config = '' )
-{
+# deploy and register a munin plugin
+define munin::plugin::deploy(
+ $ensure = 'present',
+ $source = '',
+ $config = '',
+ $seltype = 'munin_exec_t'
+) {
$plugin_src = $ensure ? {
'present' => $name,
- 'absent' => $name,
- default => $ensure
+ 'absent' => $name,
+ default => $ensure
}
-
$real_source = $source ? {
- '' => "munin/plugins/$plugin_src",
+ '' => "munin/plugins/${plugin_src}",
default => $source
}
-
include munin::plugin::scriptpaths
-
file { "munin_plugin_${name}":
- path => "$munin::plugin::scriptpaths::script_path/${name}",
- source => "puppet://$server/modules/$real_source",
- mode => 0755, owner => root, group => 0;
+ path => "${munin::plugin::scriptpaths::script_path}/${name}",
+ source => "puppet:///modules/${real_source}",
+ owner => root,
+ group => 0,
+ mode => '0755';
}
- case $kernel {
- openbsd: { $basic_require = File['/var/run/munin'] }
- default: { $basic_require = Package['munin-node'] }
- }
-
- if $require { File["munin_plugin_${name}"]{ require => [ $basic_require, $require ] } }
- else {
+ if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){
File["munin_plugin_${name}"]{
- require => $basic_require,
+ seltype => $seltype,
}
}
+ case $::kernel {
+ openbsd: { $basic_require = File['/var/run/munin'] }
+ default: { $basic_require = Package['munin-node'] }
+ }
+ File["munin_plugin_${name}"]{
+ require => $basic_require,
+ }
# register the plugin
- if $require { munin::plugin{$name: ensure => $ensure, config => $config, require => $require } }
- else {
- munin::plugin{$name: ensure => $ensure, config => $config }
+ munin::plugin{$name:
+ ensure => $ensure,
+ config => $config
}
}