2014-09-02 14:56:27 +02:00
|
|
|
# Define: icinga2::feature
|
|
|
|
#
|
|
|
|
# Enable Icinga 2 feature
|
|
|
|
#
|
|
|
|
# Requires:
|
|
|
|
#
|
|
|
|
# icinga2
|
|
|
|
#
|
|
|
|
# Sample Usage:
|
|
|
|
#
|
|
|
|
# icinga2::feature { 'example-feature'; }
|
|
|
|
#
|
2015-02-12 10:59:43 +01:00
|
|
|
define icinga2::feature ($ensure = 'present') {
|
2014-08-28 13:08:42 +02:00
|
|
|
include icinga2
|
|
|
|
|
2015-02-12 10:59:43 +01:00
|
|
|
$action = $ensure ? {
|
|
|
|
/(present)/ => 'enable',
|
|
|
|
/(absent)/ => 'disable',
|
2014-09-10 15:14:14 +02:00
|
|
|
}
|
2015-02-12 10:59:43 +01:00
|
|
|
$test = $ensure ? {
|
|
|
|
/(present)/ => '-e',
|
|
|
|
/(absent)/ => '! -e',
|
2014-09-15 12:12:21 +02:00
|
|
|
}
|
2015-02-12 10:59:43 +01:00
|
|
|
|
|
|
|
exec { "icinga2-feature-${action}-${name}":
|
|
|
|
unless => "/usr/bin/test ${test} /etc/icinga2/features-enabled/${name}.conf",
|
|
|
|
command => "/usr/sbin/icinga2 feature ${action} ${name}",
|
|
|
|
require => Package['icinga2'],
|
2014-09-10 18:14:32 +02:00
|
|
|
notify => Service['icinga2'],
|
2014-08-22 13:37:27 +02:00
|
|
|
}
|
|
|
|
}
|