Raise RLimitNPROC to 256
[mirror/dsa-puppet.git] / modules / monit / manifests / init.pp
1 # = Class: monit
2 #
3 # This class installs and configures monit
4 #
5 # == Sample Usage:
6 #
7 #   include monit
8 #
9 class monit {
10         if $::lsbmajdistrelease <= 7 {
11                 package { 'monit':
12                         ensure => installed
13                 }
14
15                 $cmd = $::lsbdistcodename ? {
16                         'squeeze'    => '/usr/sbin/monit',
17                         default  => '/usr/bin/monit',
18                 }
19
20                 augeas { 'inittab_monit':
21                         context => '/files/etc/inittab',
22                         changes => [
23                                 'set mo/runlevels 2345',
24                                 'set mo/action respawn',
25                                 "set mo/process \"$cmd -d 300 -I -c /etc/monit/monitrc -s /var/lib/monit/monit.state\"",
26                         ],
27                         notify => Exec['init q'],
28                 }
29
30                 file { '/etc/monit/':
31                         ensure  => directory,
32                         mode    => '0755',
33                         purge   => true,
34                         notify  => Exec['service monit stop'],
35                         require => Package['monit'],
36                 }
37                 file { '/etc/monit/monit.d':
38                         ensure  => directory,
39                         mode    => '0750',
40                         purge   => true,
41                 }
42                 file { '/etc/monit/monitrc':
43                         content => template('monit/monitrc.erb'),
44                         mode    => '0400'
45                 }
46                 file { '/etc/monit/monit.d/01puppet':
47                         source  => 'puppet:///modules/monit/puppet',
48                         mode    => '0440'
49                 }
50                 file { '/etc/monit/monit.d/00debian.org':
51                         source  => 'puppet:///modules/monit/debianorg',
52                         mode    => '0440'
53                 }
54                 file { '/etc/default/monit':
55                         content => template('monit/default.erb'),
56                         require => Package['monit'],
57                         notify  => Exec['service monit stop']
58                 }
59
60                 exec { 'service monit stop':
61                         refreshonly => true,
62                 }
63         } else {
64                 package { 'monit':
65                         ensure => purged
66                 }
67                 file { [ '/etc/monit/',
68                          '/etc/monit/monit.d',
69                          '/etc/monit/monit.d/01puppet',
70                          '/etc/monit/monit.d/00debian.org'
71                         ]:
72                         ensure  => absent,
73                         force   => true
74                 }
75         }
76 }