Puppet Class: profile::elasticsearch::logstash

Defined in:
modules/profile/manifests/elasticsearch/logstash.pp

Overview

SPDX-License-Identifier: Apache-2.0 vim:sw=4 ts=4 sts=4 et:

Class: role::logstash::elasticsearch

Provisions Elasticsearch backend node for a Logstash cluster.

Parameters:

  • jobs_host (Optional[Stdlib::Fqdn]) (defaults to: lookup('profile::elasticsearch::logstash::jobs_host', { default_value => undef }))
  • curator_actions (Optional[Hash]) (defaults to: lookup('profile::elasticsearch::logstash::curator_actions', { default_value => undef }))
  • dc_settings (Elasticsearch::InstanceParams) (defaults to: lookup('profile::elasticsearch::dc_settings'))


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
# File 'modules/profile/manifests/elasticsearch/logstash.pp', line 7

class profile::elasticsearch::logstash(
    Optional[Stdlib::Fqdn]        $jobs_host        = lookup('profile::elasticsearch::logstash::jobs_host',    { default_value => undef }),
    Optional[Hash]                $curator_actions  = lookup('profile::elasticsearch::logstash::curator_actions', { default_value => undef }),
    Elasticsearch::InstanceParams $dc_settings      = lookup('profile::elasticsearch::dc_settings'),
) {
    include ::profile::elasticsearch

    # tasks that should only run on one host
    if $jobs_host == $::fqdn {
        include ::profile::prometheus::es_exporter

        if ($curator_actions) {
            # all curator actions from hiera: profile::elasticsearch::logstash::curator_actions
            elasticsearch::curator::job { 'cluster_wide':
                cluster_name => $dc_settings['cluster_name'],
                actions      => $curator_actions,
            }
        }
    }

    file { '/usr/share/elasticsearch/plugins':
        ensure => 'directory',
        force  => true,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    } -> Class['elasticsearch']

    $::profile::elasticsearch::configured_instances.reduce(9108) |$prometheus_port, $kv_pair| {
        $cluster_name = $kv_pair[0]
        $cluster_params = $kv_pair[1]
        $http_port = $cluster_params['http_port']

        profile::prometheus::elasticsearch_exporter { "${::hostname}:${http_port}":
            prometheus_port    => $prometheus_port,
            elasticsearch_port => $http_port,
        }
        $prometheus_port + 1
    }
}