diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/base.pp | 4 | ||||
-rw-r--r-- | manifests/plugin/deploy.pp | 30 | ||||
-rw-r--r-- | manifests/plugin/scriptpaths.pp | 6 |
3 files changed, 39 insertions, 1 deletions
diff --git a/manifests/base.pp b/manifests/base.pp index 83ac792..13e13fd 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -69,7 +69,9 @@ class nagios::base { notify => Service['nagios'], mode => '0750', owner => root, group => nagios; } - + Package <<| tag == 'nagios::plugin::deploy::package' |>> + File <<| tag == 'nagios::plugin::deploy::file' |>> + Nagios_plugin <<||>> Nagios_command <<||>> Nagios_contact <<||>> Nagios_contactgroup <<||>> diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp new file mode 100644 index 0000000..75f87d7 --- /dev/null +++ b/manifests/plugin/deploy.pp @@ -0,0 +1,30 @@ +define nagios::plugin::deploy($source = '', $ensure = 'present', $config = '', $require_package = 'nagios-plugins') { + $plugin_src = $ensure ? { + 'present' => $name, + 'absent' => $name, + default => $ensure + } + $real_source = $source ? { + '' => "nagios/plugins/$plugin_src", + default => $source + } + + if !defined(Package[$require_package]) { + @@package { $require_package: + ensure => installed, + tag => "nagios::plugin::deploy::package"; + } + } + + include nagios::plugin::scriptpaths + @@file { "nagios_plugin_${name}": + path => "$nagios::plugin::scriptpaths::script_path/${name}", + source => "puppet://$server/modules/$real_source", + mode => 0755, owner => root, group => 0, + require => Package[$require_package], + tag => "nagios::plugin::deploy::file"; + } + + # register the plugin + @@nagios::plugin{$name: ensure => $ensure, require => Package['nagios-plugins'] } +} diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp new file mode 100644 index 0000000..6065709 --- /dev/null +++ b/manifests/plugin/scriptpaths.pp @@ -0,0 +1,6 @@ +class nagios::plugin::scriptpaths { + case $hardwaremodel { + x86_64: { $script_path = "/usr/lib64/nagios/plugins/" } + default: { $script_path = "/usr/lib/nagios/plugins" } + } +} |