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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# File 'manifests/object.pp', line 52
define icinga2::object (
String[1] $object_type,
Stdlib::Absolutepath $target,
Variant[String[1], Integer[0]] $order,
Enum['present', 'absent'] $ensure = present,
String[1] $object_name = $title,
Boolean $template = false,
Variant[Boolean, Pattern[/^.+\s+(=>\s+.+\s+)?in\s+.+$/]] $apply = false,
Array[String[1]] $attrs_list = [],
Optional[Enum['Host', 'Service']] $apply_target = undef,
Variant[Boolean, String[1]] $prefix = false,
Array[String[1]] $import = [],
Array[String[1]] $assign = [],
Array[String[1]] $ignore = [],
Hash[String[1], Any] $attrs = {},
) {
assert_private()
case $facts['os']['family'] {
'windows': {
} # windows
default: {
Concat {
owner => $icinga2::globals::user,
group => $icinga2::globals::group,
seltype => 'icinga2_etc_t',
mode => '0640',
}
} # default
}
if $object_type == $apply_target {
fail('The object type must be different from the apply target')
}
$_object = epp('icinga2/object.conf.epp',
{ 'attrs' => $attrs,
'attrs_list' => $attrs_list,
'apply' => $apply,
'apply_target' => $apply_target,
'prefix' => $prefix,
'object_type' => $object_type,
'object_name' => $object_name,
'template' => $template,
'import' => $import,
'assign' => $assign,
'ignore' => $ignore,
}
)
if !defined(Concat[$target]) {
concat { $target:
ensure => present,
tag => 'icinga2::config::file',
warn => true,
}
}
if $ensure != 'absent' {
concat::fragment { $title:
target => $target,
content => icinga::newline($_object),
order => $order,
}
}
}
|