summaryrefslogtreecommitdiff
path: root/manifests/plugin/deploy.pp
blob: cbf64fb6763ca84bef53f6eb5aa81589bd283f8e (plain)
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
# 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
  }
  $real_source = $source ? {
    ''      =>  "munin/plugins/${plugin_src}",
    default => $source
  }
  include munin::plugin::scriptpaths
  file { "munin_plugin_${name}":
    path    => "${munin::plugin::scriptpaths::script_path}/${name}",
    source  => "puppet:///modules/${real_source}",
    owner   => root,
    group   => 0,
    mode    => '0755';
  }

  if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){
    File["munin_plugin_${name}"]{
      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
  munin::plugin{$name:
    ensure => $ensure,
    config => $config
  }
}