summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorKeith Burdis <keith@burdis.org>2013-02-08 15:57:57 +0000
committerKeith Burdis <keith@burdis.org>2013-02-08 15:57:57 +0000
commit32297aace9a2f8ef1117ea233335b93f8fb0aee2 (patch)
tree2133501aa97fb1b7b22e3998bd564665cfba6fe2 /manifests
parentbdb8d71a4cffd2111be32570f1babaaae081881a (diff)
Create the site in the install class to avoid having to specify lots of dependencies. Fixes after testing.
Diffstat (limited to 'manifests')
-rw-r--r--manifests/config.pp10
-rw-r--r--manifests/host.pp6
-rw-r--r--manifests/init.pp3
-rw-r--r--manifests/install.pp11
4 files changed, 19 insertions, 11 deletions
diff --git a/manifests/config.pp b/manifests/config.pp
index 2a6f827..29af0e1 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -4,10 +4,6 @@ class check_mk::config (
) {
$etc_dir = "/omd/sites/${site}/etc"
$bin_dir = "/omd/sites/${site}/bin"
- exec { 'omd-create-site':
- command => "/usr/bin/omd create ${site}",
- creates => $etc_dir,
- }
file { "${etc_dir}/nagios/local":
ensure => directory,
}
@@ -60,7 +56,8 @@ class check_mk::config (
content => "]\n",
order => 29,
}
- check_mk::hostgroup { keys($host_groups):
+ $groups = keys($host_groups)
+ check_mk::hostgroup { $groups:
dir => "${etc_dir}/nagios/local/hostgroups",
host_groups => $host_groups,
target => "${etc_dir}/check_mk/main.mk",
@@ -76,16 +73,19 @@ class check_mk::config (
# re-read config if it changes
exec { 'check_mk-refresh':
command => "${bin_dir}/check_mk -I",
+ user => $site,
refreshonly => true,
notify => Exec['check_mk-reload'],
}
exec { 'check_mk-reload':
command => "${bin_dir}/check_mk -O",
+ user => $site,
refreshonly => true,
}
# re-read inventory at least daily
exec { 'check_mk-refresh-inventory-daily':
command => "${bin_dir}/cmk -I",
+ user => $site,
schedule => 'daily',
}
}
diff --git a/manifests/host.pp b/manifests/host.pp
index 87687a4..4e8d146 100644
--- a/manifests/host.pp
+++ b/manifests/host.pp
@@ -3,9 +3,9 @@ define check_mk::host (
$host_tags = [],
) {
$host = $title
- if size($host_tags) > 0
- $_tags = join($host_tags,'|')
- $entry = "${host}|${_tags}"
+ if size($host_tags) > 0 {
+ $taglist = join($host_tags,'|')
+ $entry = "${host}|${taglist}"
}
else {
$entry = $host
diff --git a/manifests/init.pp b/manifests/init.pp
index 31d9fd7..2686f55 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,12 +1,13 @@
class check_mk (
$filestore = undef,
$package = 'omd',
- $site = 'omd',
+ $site = 'monitoring',
$workspace = '/root/check_mk',
) {
class { 'check_mk::install':
filestore => $filestore,
package => $package,
+ site => $site,
workspace => $workspace,
}
class { 'check_mk::config':
diff --git a/manifests/install.pp b/manifests/install.pp
index ce49c46..7aba697 100644
--- a/manifests/install.pp
+++ b/manifests/install.pp
@@ -1,6 +1,7 @@
class check_mk::install (
$filestore,
$package,
+ $site,
$workspace,
) {
if $filestore {
@@ -15,8 +16,8 @@ class check_mk::install (
require => File[$workspace],
}
if $package =~ /^omd-(.*?)\.(rpm|deb)$/ {
- $type = $1
- package { 'omd':
+ $type = $2
+ package { $package:
ensure => installed,
provider => $type,
source => "${workspace}/${package}",
@@ -29,4 +30,10 @@ class check_mk::install (
ensure => installed,
}
}
+ $etc_dir = "/omd/sites/${site}/etc"
+ exec { 'omd-create-site':
+ command => "/usr/bin/omd create ${site}",
+ creates => $etc_dir,
+ require => Package[$package],
+ }
}