Defined Type: logstash::plugin

Defined in:
puppet/modules/logstash/manifests/plugin.pp

Overview

Define: logstash::plugin

A Logstash plugin.

Parameters

title

Name of the plugin. Examples:

logstash-filter-prune

Parameters:

  • ensure (Any) (defaults to: present)


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
# File 'puppet/modules/logstash/manifests/plugin.pp', line 11

define logstash::plugin(
    $ensure = present,
) {
    case $ensure {
        present: {
            exec { "install_logstash_plugin_${title}":
                command => "/usr/share/logstash/bin/logstash-plugin install '${title}'",
                require => Package['logstash'],
                notify  => Service['logstash'],
                unless  => "grep '^gem \"${title}\"$' /usr/share/logstash/Gemfile"
            }
        }
        absent: {
            exec { "uninstall_logstash_plugin_${title}":
                command => "/usr/share/logstash/bin/logstash-plugin remove '${title}'",
                require => Package['logstash'],
                notify  => Service['logstash'],
                onlyif  => "grep '^gem \"${title}\"$' /usr/share/logstash/Gemfile"
            }
        }
        default: {
            fail("'ensure' may be 'present' or 'absent' (got: '${ensure}').")
        }
    }
}