summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Burdis <keith@burdis.org>2013-02-07 13:11:20 +0000
committerKeith Burdis <keith@burdis.org>2013-02-07 13:11:20 +0000
commitdaf091c1d249703132b35380e7c973a132aca093 (patch)
tree06f7b31d736b8790c6ffd0306652d4425a42d7c2
parent6405936dae74ed336f1421a27c7c22abf6d02d9e (diff)
Use exported resources to populate all_hosts array.
-rw-r--r--manifests/agent.pp1
-rw-r--r--manifests/config.pp24
-rw-r--r--manifests/host.pp8
3 files changed, 29 insertions, 4 deletions
diff --git a/manifests/agent.pp b/manifests/agent.pp
index ab71466..9b7b0df 100644
--- a/manifests/agent.pp
+++ b/manifests/agent.pp
@@ -67,4 +67,5 @@ class check_mk::agent (
enable => true,
}
}
+ @@check_mk::host { $::fqdn: }
}
diff --git a/manifests/config.pp b/manifests/config.pp
index 0e0b740..5b714ec 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -11,11 +11,27 @@ class check_mk::config {
path => '/etc/nagios/nagios.cfg',
notify => Class['check_mk::service'],
}
- file { '/etc/check_mk/main.mk':
- ensure => present,
- content => "all_hosts = [ 'lnxmgt-01.sbetenv.ads' ]",
- notify => Exec['check_mk-restart'],
+ concat { '/etc/check_mk/main.mk':
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ }
+ concat::fragment { 'all_hosts-header':
+ target => '/etc/check_mk/main.mk',
+ content => "all_hosts = [\n",
+ order => 01,
+ }
+ concat::fragment { 'all_hosts-footer':
+ target => '/etc/check_mk/main.mk',
+ content => "]\n",
+ order => 03,
}
+ Check_mk::Host <<| |>> { notify => Exec['check_mk-restart'] }
+ #file { '/etc/check_mk/main.mk':
+ # ensure => present,
+ # content => "all_hosts = [ 'lnxmgt-01.sbetenv.ads' ]",
+ # notify => Exec['check_mk-restart'],
+ #}
exec { 'check_mk-restart':
command => '/usr/bin/check_mk -O',
refreshonly => true,
diff --git a/manifests/host.pp b/manifests/host.pp
new file mode 100644
index 0000000..5c83b96
--- /dev/null
+++ b/manifests/host.pp
@@ -0,0 +1,8 @@
+define check_mk::host {
+ $host = $title
+ concat::fragment { "check_mk-${host}":
+ target => '/etc/check_mk/main.mk',
+ content => " '${host}',\n",
+ order => 02,
+ }
+}