38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'manifests/object/servicegroup.pp', line 38
define icinga2::object::servicegroup (
Stdlib::Absolutepath $target,
Enum['absent', 'present'] $ensure = present,
String $servicegroup_name = $title,
Optional[String] $display_name = undef,
Optional[Array] $groups = undef,
Array $assign = [],
Array $ignore = [],
Boolean $template = false,
Array $import = [],
Variant[String, Integer] $order = 65,
Variant[Array[String], String] $export = [],
) {
require icinga2::globals
# compose attributes
$attrs = {
'display_name' => $display_name,
'groups' => $groups,
}
# create object
$config = {
'object_name' => $servicegroup_name,
'object_type' => 'ServiceGroup',
'import' => $import,
'template' => $template,
'attrs' => delete_undef_values($attrs),
'attrs_list' => keys($attrs),
'assign' => $assign,
'ignore' => $ignore,
}
unless empty($export) {
@@icinga2::config::fragment { "icinga2::object::ServiceGroup::${title}":
tag => prefix(any2array($export), 'icinga2::instance::'),
content => epp('icinga2/object.conf.epp', $config),
target => $target,
order => $order,
}
} else {
icinga2::object { "icinga2::object::ServiceGroup::${title}":
ensure => $ensure,
target => $target,
order => $order,
* => $config,
}
}
}
|