Puppet Class: idm::redis

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

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • redis_master (Stdlib::Fqdn)
  • redis_replicas (Array[Stdlib::Fqdn])
  • redis_password (String)
  • redis_port (Stdlib::Port)
  • redis_maxmem (Integer)


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

class idm::redis (
    Stdlib::Fqdn        $redis_master,
    Array[Stdlib::Fqdn] $redis_replicas,
    String              $redis_password,
    Stdlib::Port        $redis_port,
    Integer             $redis_maxmem,
){

    unless $redis_replicas.empty() {
        firewall::service { 'redis_replication':
            proto  => 'tcp',
            port   => $redis_port,
            srange => $redis_replicas,
        }
    }

    $base_redis_settings =  {
        bind        => [$facts['networking']['ip'], $facts['networking']['ip6']],
        maxmemory   => $redis_maxmem,
        port        => $redis_port,
        requirepass => $redis_password,
    }

    $replica_redis_settings = {
        replicaof  => "${$redis_master} ${redis_port}",
        masterauth => $redis_password,
    }

    unless $facts['networking']['hostname'] in $redis_master {
        $redis_settings = $base_redis_settings + $replica_redis_settings
    } else {
        $redis_settings =  $base_redis_settings
    }

    redis::instance { String($redis_port):
        settings => $redis_settings,
        notify   => Service['uwsgi-bitu', 'rq-bitu'],
    }
}