and enable monit from inittab: what could go wrong?
[mirror/dsa-puppet.git] / modules / monit / manifests / init.pp
1 class monit {
2     package { "monit": ensure => installed }
3
4     augeas { "inittab":
5         context => "/files/etc/inittab",
6         changes => [ "set mo/runlevels 2345",
7                      "set mo/action respawn",
8                      "set mo/process \"/usr/sbin/monit -d 300 -I -c /etc/monit/monitrc -s /var/lib/monit/monit.state\"",
9                    ],
10         onlyif => "match mo size == 0",
11         notify => Exec["init q"],
12     }
13
14
15     file {
16         "/etc/rc2.d/S99monit":
17           ensure  => absent;
18
19         "/etc/monit/":
20           ensure  => directory,
21           owner   => root,
22           group   => root,
23           mode    => 755,
24           purge   => true
25           ;
26
27         "/etc/monit/monitrc":
28           content => template("monit/monitrc.erb"),
29           require => Package["monit"],
30           notify  => Exec["monit stop"],
31           mode    => 400
32           ;
33
34         "/etc/monit/monit.d":
35           ensure  => directory,
36           owner   => root,
37           group   => root,
38           mode    => 750,
39           purge   => true
40           ;
41
42         "/etc/monit/monit.d/01puppet":
43           source  => "puppet:///monit/puppet",
44           require => Package["monit"],
45           notify  => Exec["monit stop"],
46           mode    => 440
47           ;
48
49         "/etc/monit/monit.d/00debian.org":
50           source  => "puppet:///monit/debianorg",
51           require => Package["monit"],
52           notify  => Exec["monit stop"],
53           mode    => 440
54           ;
55
56         "/etc/default/monit":
57           content => template("monit/default.erb"),
58           require => Package["monit"],
59           notify  => Exec["monit stop"]
60           ;
61     }
62     exec { "monit stop":
63         path        => "/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin",
64         refreshonly => true,
65     }
66 }
67
68 # vim:set et:
69 # vim:set sts=4 ts=4:
70 # vim:set shiftwidth=4: