mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 05:44:36 +02:00
Puppet: make icinga2::feature disableable
This commit is contained in:
parent
5c8aec0f2e
commit
c1af7415e7
@ -10,29 +10,22 @@
|
|||||||
#
|
#
|
||||||
# icinga2::feature { 'example-feature'; }
|
# icinga2::feature { 'example-feature'; }
|
||||||
#
|
#
|
||||||
define icinga2::feature ($source = undef) {
|
define icinga2::feature ($ensure = 'present') {
|
||||||
include icinga2
|
include icinga2
|
||||||
|
|
||||||
$target = "features-available/${name}"
|
$action = $ensure ? {
|
||||||
$cfgpath = '/etc/icinga2'
|
/(present)/ => 'enable',
|
||||||
$path = "${cfgpath}/features-enabled/${name}.conf"
|
/(absent)/ => 'disable',
|
||||||
|
}
|
||||||
if $source != undef {
|
$test = $ensure ? {
|
||||||
icinga2::config { $target:
|
/(present)/ => '-e',
|
||||||
source => $source,
|
/(absent)/ => '! -e',
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parent_dirs { $path:
|
exec { "icinga2-feature-${action}-${name}":
|
||||||
user => 'icinga',
|
unless => "/usr/bin/test ${test} /etc/icinga2/features-enabled/${name}.conf",
|
||||||
require => [
|
command => "/usr/sbin/icinga2 feature ${action} ${name}",
|
||||||
User['icinga'],
|
require => Package['icinga2'],
|
||||||
File['icinga2cfgDir']
|
|
||||||
],
|
|
||||||
}
|
|
||||||
-> file { $path:
|
|
||||||
ensure => link,
|
|
||||||
target => "${cfgpath}/${target}.conf",
|
|
||||||
notify => Service['icinga2'],
|
notify => Service['icinga2'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user