summaryrefslogtreecommitdiff
path: root/manifests/plugin.pp
blob: 07938cd2a30e7e862601a43ea687d30f85f970d3 (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
# a wrapper for syncing a plugin
define nagios::plugin(
  $source = 'absent',
  $ensure = present,
){
  if $::hardwaremodel == 'x86_64' and $::operatingsystem != 'Debian' {
    $real_path = "/usr/lib64/nagios/plugins/${name}"
  }
  else {
    $real_path = "/usr/lib/nagios/plugins/${name}"
  }

  $real_source = $source ? {
    'absent' => "puppet:///modules/nagios/plugins/${name}",
    default => "puppet:///modules/${source}"
  }

  file{$name:
    ensure  => $ensure,
    path    => $real_path,
    source  => $real_source,
    tag     => 'nagios_plugin',
    require => Package['nagios-plugins'],
    owner   => 'root',
    group   => 0,
    mode    => '0755';
  }
}