1 # == Define: elasticsearch::plugin
3 # This define allows you to install arbitrary Elasticsearch plugins
4 # either by using the default repositories or by specifying an URL
6 # All default values are defined in the elasticsearch::params class.
12 # Directory name where the module will be installed
13 # Value type is string
15 # This variable is required
18 # Whether the plugin will be installed or removed.
19 # Set to 'absent' to ensure a plugin is not installed
20 # Value type is string
21 # Default value: present
22 # This variable is optional
25 # Specify an URL where to download the plugin from.
26 # Value type is string
28 # This variable is optional
31 # Proxy host to use when installing the plugin
32 # Value type is string
34 # This variable is optional
37 # Proxy port to use when installing the plugin
38 # Value type is number
40 # This variable is optional
43 # Specify all the instances related
44 # value type is string or array
48 # # From official repository
49 # elasticsearch::plugin{'mobz/elasticsearch-head': module_dir => 'head'}
52 # elasticsearch::plugin{ 'elasticsearch-jetty':
53 # module_dir => 'elasticsearch-jetty',
54 # url => 'https://oss-es-plugins.s3.amazonaws.com/elasticsearch-jetty/elasticsearch-jetty-0.90.0.zip',
59 # * Matteo Sessa <mailto:matteo.sessa@catchoftheday.com.au>
60 # * Dennis Konert <mailto:dkonert@gmail.com>
61 # * Richard Pijnenburg <mailto:richard.pijnenburg@elasticsearch.com>
63 define elasticsearch::plugin(
75 path => [ '/bin', '/usr/bin', '/usr/local/bin' ],
77 user => $elasticsearch::elasticsearch_user,
82 $notify_service = $elasticsearch::restart_on_change ? {
84 default => Elasticsearch::Service[$instances],
87 if ($module_dir != '') {
88 validate_string($module_dir)
90 fail("module_dir undefined for plugin ${name}")
93 if ($proxy_host != undef and $proxy_port != undef) {
94 $proxy = " -DproxyPort=${proxy_port} -DproxyHost=${proxy_host}"
100 validate_string($url)
101 $install_cmd = "${elasticsearch::plugintool}${proxy} -install ${name} -url ${url}"
104 $install_cmd = "${elasticsearch::plugintool}${proxy} -install ${name}"
109 'installed', 'present': {
110 exec {"install_plugin_${name}":
111 command => $install_cmd,
112 creates => "${elasticsearch::plugindir}/${module_dir}",
113 returns => $exec_rets,
114 notify => $notify_service,
115 require => File[$elasticsearch::plugindir]
119 exec {"remove_plugin_${name}":
120 command => "${elasticsearch::plugintool} --remove ${module_dir}",
121 onlyif => "test -d ${elasticsearch::plugindir}/${module_dir}",
122 notify => $notify_service,