summaryrefslogtreecommitdiff
path: root/puppet/modules/check_mk/manifests/hostgroup.pp
diff options
context:
space:
mode:
Diffstat (limited to 'puppet/modules/check_mk/manifests/hostgroup.pp')
-rw-r--r--puppet/modules/check_mk/manifests/hostgroup.pp24
1 files changed, 24 insertions, 0 deletions
diff --git a/puppet/modules/check_mk/manifests/hostgroup.pp b/puppet/modules/check_mk/manifests/hostgroup.pp
new file mode 100644
index 00000000..baec45f9
--- /dev/null
+++ b/puppet/modules/check_mk/manifests/hostgroup.pp
@@ -0,0 +1,24 @@
+define check_mk::hostgroup (
+ $dir,
+ $hostgroups,
+ $target,
+) {
+ $group = $title
+ $group_tags = sprintf("'%s'", join($hostgroups[$group]['host_tags'], "', '"))
+ concat::fragment { "check_mk-hostgroup-${group}":
+ target => $target,
+ content => " ( '${group}', [ ${group_tags} ], ALL_HOSTS ),\n",
+ order => 21,
+ }
+ if $hostgroups[$group]['description'] {
+ $description = $hostgroups[$group]['description']
+ }
+ else {
+ $description = regsubst($group, '_', ' ')
+ }
+ file { "${dir}/${group}.cfg":
+ ensure => present,
+ content => "define hostgroup {\n hostgroup_name ${group}\n alias ${description}\n}\n",
+ require => File[$dir],
+ }
+}