Puppet Class: profile::redis::master

Defined in:
modules/profile/manifests/redis/master.pp

Overview

Parameters:

  • instances (Array[String]) (defaults to: lookup('profile::redis::master::instances'))
  • settings (Hash) (defaults to: lookup('profile::redis::master::settings'))
  • instance_overrides (Hash) (defaults to: lookup('profile::redis::master::instance_overrides', {'default_value' => {}}))
  • password (String) (defaults to: lookup('profile::redis::master::password'))
  • aof (Boolean) (defaults to: lookup('profile::redis::master::aof', {'default_value' => false}))
  • clients (Array[String]) (defaults to: lookup('profile::redis::master::clients', {'default_value' => []}))
  • prometheus_nodes (Array[Stdlib::Host]) (defaults to: lookup('prometheus_nodes'))


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
# File 'modules/profile/manifests/redis/master.pp', line 1

class profile::redis::master(
    Array[String]       $instances          = lookup('profile::redis::master::instances'),
    Hash                $settings           = lookup('profile::redis::master::settings'),
    Hash                $instance_overrides = lookup('profile::redis::master::instance_overrides',
                                                    {'default_value' => {}}),
    String              $password           = lookup('profile::redis::master::password'),
    Boolean             $aof                = lookup('profile::redis::master::aof',
                                                    {'default_value' => false}),
    Array[String]       $clients            = lookup('profile::redis::master::clients',
                                                    {'default_value' => []}),
    Array[Stdlib::Host] $prometheus_nodes   = lookup('prometheus_nodes'),
){
    $uris = apply_format("localhost:%s/${password}", $instances)
    $redis_ports = join($instances, ' ')

    $auth_settings = {
        'masterauth'  => $password,
        'requirepass' => $password,
    }

    $srange = $clients.empty? {
        true    => undef,
        default => inline_template("@resolve((<%= @clients.join(' ') %>))"),
    }

    $instances.each |String $instance| {
        if $instance in keys($instance_overrides) {
            $override = $instance_overrides[$instance]
        } else {
            $override = {}
        }
        profile::redis::instance { $instance:
            settings => merge($settings, $auth_settings, $override),
            aof      => $aof,
        }
    }

    # Add monitoring, using nrpe and not remote checks anymore
    redis::monitoring::nrpe_instance { $instances: }

    profile::prometheus::redis_exporter{ $instances:
        password         => $password,
        prometheus_nodes => $prometheus_nodes,
    }

    ferm::service { 'redis_master_role':
        proto   => 'tcp',
        notrack => true,
        port    => inline_template('(<%= @redis_ports %>)'),
        srange  => $srange,
    }
}