2014-08-03 07:01:15 +02:00
|
|
|
# == Defined type: icinga2::object::user
|
2014-09-14 04:46:24 +02:00
|
|
|
#
|
2014-08-03 07:01:15 +02:00
|
|
|
# This is a defined type for Icinga 2 user objects.
|
|
|
|
# See the following Icinga 2 doc page for more info:
|
|
|
|
# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-user
|
|
|
|
#
|
|
|
|
# === Parameters
|
|
|
|
#
|
|
|
|
# See the inline comments.
|
|
|
|
#
|
|
|
|
|
|
|
|
define icinga2::object::user (
|
2014-08-03 07:03:38 +02:00
|
|
|
$object_username = $name,
|
2014-08-03 07:28:34 +02:00
|
|
|
$display_name = $name,
|
2014-08-04 03:20:29 +02:00
|
|
|
$email = undef,
|
2014-08-04 03:23:28 +02:00
|
|
|
$pager = undef,
|
2014-08-04 03:24:26 +02:00
|
|
|
$vars = {},
|
2014-08-04 03:26:36 +02:00
|
|
|
$groups = [],
|
2014-08-04 03:27:46 +02:00
|
|
|
$enable_notifications = undef,
|
2014-08-04 04:14:02 +02:00
|
|
|
$period = undef,
|
2014-08-04 04:15:57 +02:00
|
|
|
$types = [],
|
2014-08-04 04:16:58 +02:00
|
|
|
$states = [],
|
2014-11-22 06:24:05 +01:00
|
|
|
$target_dir = '/etc/icinga2/objects',
|
2014-08-25 02:59:58 +02:00
|
|
|
$target_file_name = "${name}.conf",
|
2014-11-19 06:55:48 +01:00
|
|
|
$target_file_ensure = file,
|
2014-08-03 07:01:15 +02:00
|
|
|
$target_file_owner = 'root',
|
|
|
|
$target_file_group = 'root',
|
2014-09-26 21:02:33 +02:00
|
|
|
$target_file_mode = '0644'
|
2014-08-03 07:01:15 +02:00
|
|
|
) {
|
|
|
|
|
2014-09-07 03:50:21 +02:00
|
|
|
#Do some validation of the class' parameters:
|
|
|
|
validate_string($object_username)
|
|
|
|
validate_string($display_name)
|
2014-09-14 04:46:24 +02:00
|
|
|
validate_string($host_name)
|
2014-09-07 03:50:21 +02:00
|
|
|
validate_array($groups)
|
|
|
|
validate_hash($vars)
|
|
|
|
validate_array($types)
|
|
|
|
validate_array($states)
|
|
|
|
validate_string($target_dir)
|
|
|
|
validate_string($target_file_name)
|
|
|
|
validate_string($target_file_owner)
|
|
|
|
validate_string($target_file_group)
|
|
|
|
validate_string($target_file_mode)
|
|
|
|
|
2014-08-03 07:01:15 +02:00
|
|
|
file {"${target_dir}/${target_file_name}":
|
2014-11-19 06:55:48 +01:00
|
|
|
ensure => $target_file_ensure,
|
2014-08-03 07:01:15 +02:00
|
|
|
owner => $target_file_owner,
|
|
|
|
group => $target_file_group,
|
|
|
|
mode => $target_file_mode,
|
|
|
|
content => template('icinga2/object_user.conf.erb'),
|
2014-09-26 20:59:12 +02:00
|
|
|
notify => Service['icinga2'],
|
2014-08-03 07:01:15 +02:00
|
|
|
}
|
|
|
|
|
2014-09-14 04:46:24 +02:00
|
|
|
}
|