forked from voxpupuli/puppet-icinga2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobjects_from_hiera.pp
44 lines (40 loc) · 988 Bytes
/
objects_from_hiera.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#---
#monitoring::objects:
# 'icinga2::object::host':
# centos7.localdomain:
# address: 127.0.0.1
# vars:
# os: Linux
# 'icinga2::object::service':
# ping4:
# check_command: ping4
# apply: true
# assign:
# - host.address
# ssh:
# check_command: ssh
# apply: true
# assign:
# - host.address && host.vars.os == Linux
#
#monitoring::defaults:
# 'icinga2::object::host':
# import:
# - generic-host
# target: /etc/icinga2/conf.d/hosts.conf
# 'icinga2::object::service':
# import:
# - generic-service
# target: /etc/icinga2/conf.d/services.conf
class { 'icinga2':
manage_repo => true,
}
$defaults = lookup('monitoring::defaults')
lookup('monitoring::objects').each |String $object_type, Hash $content| {
$content.each |String $object_name, Hash $object_config| {
ensure_resource(
$object_type,
$object_name,
deep_merge($defaults[$object_type], $object_config))
}
}