aboutsummaryrefslogtreecommitdiff
path: root/manifests/subsystem/monitor/master.pp
blob: d6f09b7437bd57130ae491487c9e4b017eb9f2d6 (plain)
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
class nodo::subsystem::monitor::master {
  file { '/etc/nagios-plugins/check_rbl.ini':
    ensure  => present,
    owner   => root,
    group   => root,
    source  => 'puppet:///modules/nodo/etc/nagios-plugins/check_rbl.ini',
    require => Package['nagios'],
  }

  $main = hiera('nodo::role::master::main',        false)

  if $main == true {
    $ensure  = 'present'
    $package = 'installed'
    $service = 'running'
  } else {
    $ensure  = 'absent'
    $package = 'purged'
    $service = 'stopped'
  }

  #
  # See https://raymii.org/s/tutorials/Munin_optimalization_on_Debian.html
  #     https://munin.readthedocs.org/en/latest/master/rrdcached.html
  #     http://kuszelas.eu/~eyck/log/Howto/Munin.Rrdcached.html
  #
  package { 'rrdcached':
    ensure => $package,
  }

  file { '/etc/default/rrdcached':
    ensure  => $ensure,
    owner   => root,
    group   => root,
    source  => 'puppet:///modules/nodo/etc/default/rrdcached',
    require => Package['rrdcached'],
    notify  => Service['rrdcached'],
  }

  service { 'rrdcached':
    ensure  => $service,
    require => Package['rrdcached'],
  }
}