diff options
author | Micah <micah@leap.se> | 2016-05-24 10:19:41 -0400 |
---|---|---|
committer | Micah <micah@leap.se> | 2016-05-24 10:19:41 -0400 |
commit | 783f953a87ef0531dd0b43614a101362c3e592c5 (patch) | |
tree | 1b2b12314188537703cc79ee784f5be33c7c2ad6 /puppet/modules/check_mk/manifests/hostgroup.pp | |
parent | 8d50b8cf042eb3b25095281734c8dd58e606c018 (diff) | |
parent | c9d50f333a81c716f3e227e9eb449dc76b6eb6e3 (diff) |
Merge commit 'c9d50f333a81c716f3e227e9eb449dc76b6eb6e3' as 'puppet/modules/check_mk'
Diffstat (limited to 'puppet/modules/check_mk/manifests/hostgroup.pp')
-rw-r--r-- | puppet/modules/check_mk/manifests/hostgroup.pp | 24 |
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], + } +} |