-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.pp
55 lines (52 loc) · 1.4 KB
/
plugin.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# == Definition: kibana5::plugin
#
# Manages a Kibana5 plugin
#
# === Parameters
#
# ...
#
# === Authors
#
# Matt Wise <[email protected]>
#
define kibana5::plugin (
$ensure = 'present',
$url = undef,
) {
include ::kibana5
include ::kibana5::service
$_install_dir = $::kibana5::install_dir
$_bin_dir = $::kibana5::bin_dir
$_plugin_dir = "${_install_dir}/plugins"
case $ensure {
'present': {
if !$url {
exec { "install_kibana_plugin_${name}":
command => "${_bin_dir}/kibana-plugin install ${name}",
path => "${_bin_dir}:/sbin:/bin:/usr/sbin:/usr/bin",
creates => "${_plugin_dir}/${name}",
notify => Class['kibana5::service'];
}
} else {
exec { "install_kibana_plugin_${name}":
command => "${_bin_dir}/kibana-plugin install ${name} -u ${url}",
path => "${_bin_dir}:/sbin:/bin:/usr/sbin:/usr/bin",
unless => "test -d ${_plugin_dir}/${name}",
notify => Class['kibana5::service'];
}
}
}
'absent': {
exec { "remove_kibana_plugin_${name}":
command => "rm -rf ${_plugin_dir}/${name}",
path => '/sbin:/bin:/usr/sbin:/usr/bin',
unless => "test ! -d ${_plugin_dir}/${name}",
notify => Class['kibana5::service'];
}
}
default: {
fail('`ensure` should be either `present` or `absent`')
}
}
}