Defined Type: profile::redis::multidc_instance

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

Overview

Parameters:

  • ip (Any)
  • shards (Any)
  • settings (Any) (defaults to: {})
  • discovery (Any) (defaults to: undef)
  • aof (Any) (defaults to: false)


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

define profile::redis::multidc_instance(
    $ip,
    $shards,
    $settings = {},
    $discovery = undef,
    $aof = false,
) {
    $replica_state_file = "/etc/redis/replica/${title}-state.conf"

    if $aof {
        $base_settings = {
            appendfilename => "${::hostname}-${title}.aof",
            dbfilename     => "${::hostname}-${title}.rdb",
            'include'      => $replica_state_file,
        }
    } else {
        $base_settings = {
            dbfilename => "${::hostname}-${title}.rdb",
            'include'  => $replica_state_file,
        }
    }

    ::redis::instance { $title:
        settings => merge($base_settings, $settings)
    }

    if $discovery {
        confd::file { $replica_state_file:
            ensure     => present,
            prefix     => "/discovery/${discovery}",
            watch_keys => ['/'],
            content    => template('profile/jobqueue_redis/statefile.tpl.erb'),
        }
        Base::Service_unit['confd'] -> Base::Service_unit["redis-instance-tcp_${title}"]

    } else {
        file { $replica_state_file:
            ensure  => 'present',
            content => "# This is a placeholder file, do not remove\n",
            owner   => 'root',
            group   => 'root',
            mode    => '0444',
            before  => Base::Service_unit["redis-instance-tcp_${title}"]
        }
    }
}