Puppet Class: ores::redis

Defined in:
modules/ores/manifests/redis.pp

Overview

Parameters:

  • queue_maxmemory (Any)
  • cache_maxmemory (Any)
  • password (Any) (defaults to: undef)
  • slaveof (Any) (defaults to: undef)


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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'modules/ores/manifests/redis.pp', line 1

class ores::redis(
    $queue_maxmemory,
    $cache_maxmemory,
    $password=undef,
    $slaveof=undef,
) {
    $common_settings = {
            bind                        => '0.0.0.0',
            appendonly                  => true,
            auto_aof_rewrite_min_size   => '512mb',
            client_output_buffer_limit  => 'slave 512mb 200mb 60',
            dir                         => '/srv/redis',
            no_appendfsync_on_rewrite   => true,
            save                        => '""',
            stop_writes_on_bgsave_error => false,
            slave_read_only             => false,
            tcp_keepalive               => 60,
            'maxmemory-policy'          => 'volatile-lru',
    }
    $instance_settings = {
        '6379' => {
            appendonly     => false,
            maxmemory      => $queue_maxmemory,
            appendfilename => "${::hostname}-6379.aof",
            dbfilename     => "${::hostname}-6379.rdb",
        },
        '6380' => {
            maxmemory      => $cache_maxmemory,
            appendfilename => "${::hostname}-6380.aof",
            dbfilename     => "${::hostname}-6380.rdb",
        },
    }

    # If we specified a password use it
    if $password {
        $password_settings = {
            '6379' => {
                masterauth  => $password,
                requirepass => $password,
            },
            '6380' => {
                masterauth  => $password,
                requirepass => $password,
            },
        }
    } else {
        $password_settings = {}
    }
    # if we specified a slave, use it
    if $slaveof {
        $slave_settings = {
            '6379' => {
                slaveof => "${slaveof} 6379",
            },
            '6380' => {
                slaveof => "${slaveof} 6380",
            },
        }
    } else {
        $slave_settings = {}
    }
    $instances = keys($instance_settings)
    $instance_settings_real = deep_merge($instance_settings, $password_settings, $slave_settings)

    redis::instance { $instances:
        settings => $common_settings,
        map      => $instance_settings_real,
    }
    redis::monitoring::nrpe_instance{ $instances: }

    $uris = apply_format("localhost:%s/${password}", $instances)
}