muninmaster -> hiera role, new ssh store/collect, no more plain text munin fetching...
[mirror/dsa-puppet.git] / modules / munin / manifests / init.pp
index 9684a29..87ba748 100644 (file)
@@ -1,79 +1,80 @@
+# our munin class
 class munin {
+  package { 'munin-node':
+    ensure => installed
+  }
 
-       package { 'munin-node':
-               ensure => installed
-       }
+  service { 'munin-node':
+    ensure  => running,
+    require => Package['munin-node'],
+  }
 
-       service { 'munin-node':
-               ensure  => running,
-               require => Package['munin-node'],
-       }
+  file { '/var/log/munin':
+    ensure => directory,
+    owner  => root,
+    group  => 'www-data',
+    mode   => '0755',
+  }
 
-       $owner = $::lsbdistcodename ? {
-               squeeze => munin,
-               wheezy  => root,
-               undef => munin,
-       }
+  file { '/etc/munin/munin-node.conf':
+    content => template('munin/munin-node.conf.erb'),
+    require => Package['munin-node'],
+    notify  => Service['munin-node'],
+  }
 
-       $gid = $::lsbdistcodename ? {
-               squeeze => adm,
-               wheezy  => 'www-data',
-               undef => adm,
-       }
+  file { '/etc/munin/plugin-conf.d/munin-node':
+    content => template('munin/munin-node.plugin.conf.erb'),
+    require => Package['munin-node'],
+    notify  => Service['munin-node'],
+  }
 
-       file { '/var/log/munin':
-               ensure => directory,
-               owner  => $owner,
-               group  => $gid,
-               mode   => '0755',
-       }
+  file { '/etc/logrotate.d/munin-node':
+    source  => 'puppet:///modules/munin/logrotate',
+    require => Package['munin-node'],
+  }
 
-       file { '/etc/munin/munin-node.conf':
-               content => template('munin/munin-node.conf.erb'),
-               require => Package['munin-node'],
-               notify  => Service['munin-node'],
-       }
+  file { '/etc/munin/plugins/df':
+    ensure  => link,
+    target  => '/usr/share/munin/plugins/df',
+    require => Package['munin-node'],
+    notify  => Service['munin-node'],
+  }
 
-       file { '/etc/munin/plugin-conf.d/munin-node':
-               content => template('munin/munin-node.plugin.conf.erb'),
-               require => Package['munin-node'],
-               notify  => Service['munin-node'],
-       }
+  file { '/etc/munin/plugins/df_abs':
+    ensure  => file,
+    source  => 'puppet:///modules/munin/df-wrap',
+    mode    => '0555',
+    require => Package['munin-node'],
+    notify  => Service['munin-node'],
+  }
 
-       file { [ '/etc/munin/plugins/df', '/etc/munin/plugins/df_abs', '/etc/munin/plugins/df_inode' ]:
-               source => 'puppet:///modules/munin/df-wrap',
-               mode    => '0555',
-               require => Package['munin-node'],
-               notify  => Service['munin-node'],
-       }
+  file { '/etc/munin/plugins/df_inode':
+    ensure  => link,
+    target  => '/usr/share/munin/plugins/df_inode',
+    require => Package['munin-node'],
+    notify  => Service['munin-node'],
+  }
 
-       @ferm::rule { 'dsa-munin-v4':
-               description     => 'Allow munin from munin master',
-               rule            => 'proto tcp mod state state (NEW) dport (munin) @subchain \'munin\' { saddr ($HOST_MUNIN_V4 $HOST_NAGIOS_V4) ACCEPT; }',
-               notarule        => true,
-       }
+  @@munin::master_per_node { $::fqdn: }
 
-       @ferm::rule { 'dsa-munin-v6':
-               description     => 'Allow munin from munin master',
-               domain          => 'ip6',
-               rule            => 'proto tcp mod state state (NEW) dport (munin) @subchain \'munin\' { saddr ($HOST_MUNIN_V6 $HOST_NAGIOS_V6) ACCEPT; }',
-               notarule        => true,
-       }
-
-       @@munin::master-per-node {
-               $::fqdn:
-                       ipaddress   => $::ipaddress,
-                       munin_async => $::munin_async,
-                       ;
-       }
-
-       if $::munin_async and str2bool($::munin_async) == true {
-               file { '/etc/ssh/userkeys/munin-async':
-                       source => 'puppet:///modules/munin/munin-async-authkeys',
-               }
-       } else {
-               file { '/etc/ssh/userkeys/munin-async':
-                       ensure => 'absent',
-               }
-       }
+  package { 'munin-async':
+    ensure => installed
+  }
+  service { 'munin-async':
+    ensure  => running,
+    require => Package['munin-async'],
+  }
+  dsa_systemd::override { 'munin-async':
+    content  => @("EOF"),
+      [Service]
+      RestartSec=10
+      | EOF
+  }
+  file { '/etc/ssh/userkeys/munin-async':
+    ensure => 'absent',
+  }
+  ssh::authorized_key_collect { 'munin-async-fetcher':
+    target_user => 'munin-async',
+    collect_tag => 'munin::munin-async-fetch',
+  }
 }