summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>2009-12-02 15:31:08 -0500
committerJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>2009-12-02 15:31:08 -0500
commit0bcac1357115fe9b03ec884632d46c93efb317d9 (patch)
treec87474ff831938e7f191d40f665184cfef912e12
parent3c15393af5c8fb0c7d66ece27a70b86709f1af82 (diff)
remove host wrapper, instead define using native type in target, and create a target::nat subclass
-rw-r--r--manifests/extra_host.pp24
-rw-r--r--manifests/host.pp37
-rw-r--r--manifests/target.pp12
-rw-r--r--manifests/target/host.pp6
-rw-r--r--manifests/target/nat.pp5
5 files changed, 16 insertions, 68 deletions
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}" }
+
+}