Puppet Class: profile::redis::master

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

Overview

SPDX-License-Identifier: Apache-2.0

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' => []}))


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

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' => []}),
){
    $uris = $instances.map |$instance| { "localhost:${instance}/${password}" }
    $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,
    }

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