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