From 0bcac1357115fe9b03ec884632d46c93efb317d9 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Wed, 2 Dec 2009 15:31:08 -0500 Subject: remove host wrapper, instead define using native type in target, and create a target::nat subclass --- manifests/extra_host.pp | 24 ------------------------ manifests/host.pp | 37 ------------------------------------- manifests/target.pp | 12 +++++++++++- manifests/target/host.pp | 6 ------ manifests/target/nat.pp | 5 +++++ 5 files changed, 16 insertions(+), 68 deletions(-) delete mode 100644 manifests/extra_host.pp delete mode 100644 manifests/host.pp delete mode 100644 manifests/target/host.pp create mode 100644 manifests/target/nat.pp (limited to 'manifests') diff --git a/manifests/extra_host.pp b/manifests/extra_host.pp deleted file mode 100644 index 3150612..0000000 --- a/manifests/extra_host.pp +++ /dev/null @@ -1,24 +0,0 @@ -# this will define a host which isn't managed by puppet. -# a ping serivce is automatically added -define nagios::extra_host( - $ensure = present, - $ip, - $nagios_alias, - $use = 'generic-host', - $parents = 'localhost' -) { - nagios::host{$name: - ensure => $ensure, - ip => $ip, - nagios_alias => $nagios_alias, - use => $use, - parents => $parents - } - - nagios::service { "check_ping_${name}": - ensure => $ensure, - host_name => $name, - check_command => 'check_ping!100.0,20%!500.0,60%', - service_description => "check_ping_${nagios_alias}", - } -} diff --git a/manifests/host.pp b/manifests/host.pp deleted file mode 100644 index 8814738..0000000 --- a/manifests/host.pp +++ /dev/null @@ -1,37 +0,0 @@ -define nagios::host( - $ensure = present, - $ip = $fqdn, - $nagios_alias = $hostname, - $check_command = 'check-host-alive', - $max_check_attempts = 4, - $notification_interval = 120, - $notification_period = '24x7', - $notification_options = 'd,r', - $use = 'generic-host', - $nagios_contact_groups_in = $nagios_contact_groups, - $parents = 'localhost' ) -{ - $real_nagios_contact_groups = $nagios_contact_groups_in ? { - '' => 'admins', - default => $nagios_contact_groups_in - } - $real_nagios_parents = $parents ? { - '' => 'localhost', - default => $parents - } - - @@nagios_host { $name: - ensure => $ensure, - address => $ip, - alias => $nagios_alias, - check_command => $check_command, - max_check_attempts => $max_check_attempts, - notification_interval => $notification_interval, - notification_period => $notification_period, - notification_options => $notification_options, - parents => $real_nagios_parents, - contact_groups => $real_nagios_contact_groups, - use => $use, - notify => Service[nagios], - } -} diff --git a/manifests/target.pp b/manifests/target.pp index a58912e..675ac1a 100644 --- a/manifests/target.pp +++ b/manifests/target.pp @@ -1,5 +1,15 @@ # manifests/target.pp class nagios::target { - include nagios::target::host + + @@nagios_host { "${fqdn}": + address => $ipaddress, + alias => $hostname, + use => 'generic-host', + } + + if ($nagios_parents != '') { + Nagios_host["${fqdn}"] { parents => $nagios_parents } + } + } diff --git a/manifests/target/host.pp b/manifests/target/host.pp deleted file mode 100644 index 8ba4e77..0000000 --- a/manifests/target/host.pp +++ /dev/null @@ -1,6 +0,0 @@ -# manifests/target/host.pp - -class nagios::target::host { - nagios::host { $fqdn: parents => $nagios_parent } -} - diff --git a/manifests/target/nat.pp b/manifests/target/nat.pp new file mode 100644 index 0000000..abb0a1e --- /dev/null +++ b/manifests/target/nat.pp @@ -0,0 +1,5 @@ +class nagios::target::nat inherits nagios::target { + + Nagios_host["${fqdn}"] { address => "${fqdn}" } + +} -- cgit v1.2.3