]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/munin/manifests/init.pp
19b563f4c2a8216bd43f852b02fc9fd1942b1341
[dsa-puppet.git] / modules / munin / manifests / init.pp
1 class munin {
2
3         package { 'munin-node':
4                 ensure => installed
5         }
6
7         service { 'munin-node':
8                 ensure  => running,
9                 require => Package['munin-node'],
10         }
11
12         $owner = $::lsbdistcodename ? {
13                 squeeze => munin,
14                 default  => root,
15         }
16
17         $gid = $::lsbdistcodename ? {
18                 squeeze => adm,
19                 default => 'www-data',
20         }
21
22         file { '/var/log/munin':
23                 ensure => directory,
24                 owner  => $owner,
25                 group  => $gid,
26                 mode   => '0755',
27         }
28
29         file { '/etc/munin/munin-node.conf':
30                 content => template('munin/munin-node.conf.erb'),
31                 require => Package['munin-node'],
32                 notify  => Service['munin-node'],
33         }
34
35         file { '/etc/munin/plugin-conf.d/munin-node':
36                 content => template('munin/munin-node.plugin.conf.erb'),
37                 require => Package['munin-node'],
38                 notify  => Service['munin-node'],
39         }
40
41         file { '/etc/logrotate.d/munin-node':
42                 source => 'puppet:///modules/munin/logrotate',
43                 require => Package['munin-node'],
44         }
45
46         file { [ '/etc/munin/plugins/df', '/etc/munin/plugins/df_abs', '/etc/munin/plugins/df_inode' ]:
47                 source => 'puppet:///modules/munin/df-wrap',
48                 mode    => '0555',
49                 require => Package['munin-node'],
50                 notify  => Service['munin-node'],
51         }
52
53         @ferm::rule { 'dsa-munin-v4':
54                 description     => 'Allow munin from munin master',
55                 rule            => 'proto tcp mod state state (NEW) dport (munin) @subchain \'munin\' { saddr ($HOST_MUNIN_V4 $HOST_NAGIOS_V4) ACCEPT; }',
56                 notarule        => true,
57         }
58
59         @ferm::rule { 'dsa-munin-v6':
60                 description     => 'Allow munin from munin master',
61                 domain          => 'ip6',
62                 rule            => 'proto tcp mod state state (NEW) dport (munin) @subchain \'munin\' { saddr ($HOST_MUNIN_V6 $HOST_NAGIOS_V6) ACCEPT; }',
63                 notarule        => true,
64         }
65
66         @@munin::master-per-node {
67                 $::fqdn:
68                         ipaddress   => $::ipaddress,
69                         munin_async => $::munin_async,
70                         ;
71         }
72
73         #if $::munin_async and str2bool($::munin_async) == true {
74         #       file { '/etc/ssh/userkeys/munin-async':
75         #               source => 'puppet:///modules/munin/munin-async-authkeys',
76         #       }
77         #} else {
78         #       file { '/etc/ssh/userkeys/munin-async':
79         #               ensure => 'absent',
80         #       }
81         #}
82         if $::lsbmajdistrelease >= 7 {
83                 package { 'munin-async':
84                         ensure => installed
85                 }
86                 file { '/etc/ssh/userkeys/munin-async':
87                         source => 'puppet:///modules/munin/munin-async-authkeys',
88                 }
89         }
90 }