Puppet Class: sensu::transport

Defined in:
manifests/transport.pp

Summary

Configures Sensu transport

Overview

Configure Sensu Transport



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
# File 'manifests/transport.pp', line 6

class sensu::transport {

  case $::osfamily {
    'Darwin': {
      $ensure = present
    }
    default: {
      if $::sensu::transport_type == 'redis'
      or $::sensu::transport_type == 'rabbitmq' {
        $ensure = 'present'
      } else {
        $ensure = 'absent'
      }
    }
  }

  $transport_type_hash = {
    'transport' => {
      'name'               => $::sensu::transport_type,
      'reconnect_on_error' => $::sensu::transport_reconnect_on_error,
    },
  }

  $file_mode = $::osfamily ? {
    'windows' => undef,
    default   => '0440',
  }

  file { "${sensu::conf_dir}/transport.json":
    ensure  => $ensure,
    owner   => $::sensu::user,
    group   => $::sensu::group,
    mode    => $file_mode,
    content => inline_template('<%= JSON.pretty_generate(@transport_type_hash) %>'),
    notify  => $::sensu::check_notify,
  }
}