summaryrefslogtreecommitdiff
path: root/manifests/plugin.pp
blob: f2e4ed26b1bbef801fc0d51ed6933e9eb7ec4fd1 (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
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';
  }
}