Puppet Class: sensu::redis::config

Defined in:
manifests/redis/config.pp

Summary

Sets the Sensu redis config

Overview

Sets the Sensu redis config



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
# File 'manifests/redis/config.pp', line 5

class sensu::redis::config {

  if $::sensu::_purge_config and !$::sensu::server and !$::sensu::api and !$::sensu::enterprise and $::sensu::transport_type != 'redis' {
    $ensure = 'absent'
  } else {
    $ensure = 'present'
  }

  # redis configuration may contain "secrets"
  file { "${sensu::etc_dir}/conf.d/redis.json":
    ensure => $ensure,
    owner  => $::sensu::user,
    group  => $::sensu::group,
    mode   => $::sensu::file_mode,
    before => Sensu_redis_config[$::fqdn],
  }

  $has_sentinels = !($::sensu::redis_sentinels == undef or $::sensu::redis_sentinels == [])
  $host = $has_sentinels ? { false => $::sensu::redis_host, true  => undef, }
  $port = $has_sentinels ? { false => $::sensu::redis_port, true  => undef, }
  $sentinels = $has_sentinels ? { true  => $::sensu::redis_sentinels, false => undef, }
  $master = $has_sentinels ? { true => $::sensu::redis_master, false => undef, }

  sensu_redis_config { $::fqdn:
    ensure             => $ensure,
    base_path          => "${sensu::etc_dir}/conf.d",
    host               => $host,
    port               => $port,
    password           => $::sensu::redis_password,
    reconnect_on_error => $::sensu::redis_reconnect_on_error,
    db                 => $::sensu::redis_db,
    auto_reconnect     => $::sensu::redis_auto_reconnect,
    sentinels          => $sentinels,
    master             => $master,
    tls                => $::sensu::redis_tls,
  }
}