From: Peter Palfrader <peter@palfrader.org>
Date: Mon, 27 Aug 2012 12:14:22 +0000 (+0000)
Subject: More munin stuff, supporting munin-async if it is on the client
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0ad5c1956a6e44f1d7ef04641a6fa0b03a6bec34;p=dsa-puppet.git

More munin stuff, supporting munin-async if it is on the client
---

diff --git a/modules/debian-org/lib/facter/software.rb b/modules/debian-org/lib/facter/software.rb
index de30d49a..533c7793 100644
--- a/modules/debian-org/lib/facter/software.rb
+++ b/modules/debian-org/lib/facter/software.rb
@@ -142,7 +142,7 @@ Facter.add("unbound") do
 		end
 	end
 end
-Facter.add("munin-async") do
+Facter.add("munin_async") do
 	setcode do
 		FileTest.exist?("/usr/share/munin/munin-async")
 	end
diff --git a/modules/munin/files/munin-async-authkeys b/modules/munin/files/munin-async-authkeys
new file mode 100644
index 00000000..bf33aece
--- /dev/null
+++ b/modules/munin/files/munin-async-authkeys
@@ -0,0 +1 @@
+command="/usr/share/munin/munin-async --spoolfetch",from="206.12.19.143",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,no-user-rc ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCiaY2clXjSIwjwBKolGN+JYuCev6kXzxPbX7pG8zVmdOjfEVpS2gPbWDliIyrpSxXbOPjswHcBEh67NWLAb4lLaAQ/neWrCzzri6hyPQMsl27kqFUzqHbqJml5tTDJlT/wBrNThuWIAWblS9Ck44fPnoRcJEyosGF1dOZVwYvcTGGLQMRq3U09HgatFJvNVX4x2IVBo5jDOCOZSGx5Ur+vAIJSxcQFY4DuT5Ee3ggx7g1PU36ciL0I0Ep3T8epr0yJwrXjtnpvJHOr3q4zDt5L5+XFZeozeYzG6w3NNVYA52knVNNsIzwKiy+hyHwiLf+Si0h4iTQ60jUr2pcOAeVn munin@menotti (2012-08-07)
diff --git a/modules/munin/manifests/init.pp b/modules/munin/manifests/init.pp
index d5df24ef..8258f9b1 100644
--- a/modules/munin/manifests/init.pp
+++ b/modules/munin/manifests/init.pp
@@ -60,5 +60,20 @@ class munin {
 		notarule        => true,
 	}
 
-	@@munin::master-per-node { $::fqdn: }
+	@@munin::master-per-node {
+		$::fqdn:
+			ipaddress => $::ipaddress,
+			munin_async => $::munin_async,
+			;
+	}
+
+	if $munin_async and $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',
+		}
+	}
 }
diff --git a/modules/munin/manifests/master-per-node.pp b/modules/munin/manifests/master-per-node.pp
index 5f8dee9b..1d8864e2 100644
--- a/modules/munin/manifests/master-per-node.pp
+++ b/modules/munin/manifests/master-per-node.pp
@@ -1,4 +1,8 @@
-define munin::master-per-node() {
+define munin::master-per-node($ipaddress, $munin_async) {
+	$client_fqdn               = $name
+	$client_ipaddress          = $ipaddress
+	$client_munin_async        = $munin_async
+
 	file { "/etc/munin/munin-conf.d/${name}.conf":
 		content => template('munin/munin.conf-per-node.erb'),
 	}
diff --git a/modules/munin/manifests/master.pp b/modules/munin/manifests/master.pp
index 6f606e37..e53aba3a 100644
--- a/modules/munin/manifests/master.pp
+++ b/modules/munin/manifests/master.pp
@@ -11,9 +11,12 @@ class munin::master {
 
 	if $::hostname == 'menotti' {
 		file { '/etc/munin/munin-conf.d':
-			ensure => directory,
-			mode   => 755,
-			;
+			ensure  => directory,
+			mode    => '0755',
+			purge   => true,
+			force   => true,
+			recurse => true,
+			source  => 'puppet:///files/empty/',
 		}
 
 		Munin::Master-per-node<<| |>>
diff --git a/modules/munin/templates/munin.conf-per-node.erb b/modules/munin/templates/munin.conf-per-node.erb
index e163d29f..c7f39b62 100644
--- a/modules/munin/templates/munin.conf-per-node.erb
+++ b/modules/munin/templates/munin.conf-per-node.erb
@@ -2,5 +2,9 @@
 ### THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
 ##
 
-[<%= fqdn %>]
-    address <%= ipaddress %>
+[<%= client_fqdn %>]
+<%- if has_variable?('client_munin_async') and client_munin_async and client_munin_async == "true" %>
+    address ssh://munin-async@<%= client_fqdn %>/set-in-authkeys
+<%- else %>
+    address <%= client_ipaddress %>
+<%- end %>
diff --git a/modules/munin/templates/munin.conf.erb b/modules/munin/templates/munin.conf.erb
index b223bd65..519e033a 100644
--- a/modules/munin/templates/munin.conf.erb
+++ b/modules/munin/templates/munin.conf.erb
@@ -3,6 +3,10 @@
 ### USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
 ##
 
+includedir /etc/munin/munin-conf.d
+
+<% if hostname != "menotti" -%>
+
 dbdir   /var/lib/munin
 htmldir /var/cache/munin/www
 logdir  /var/log/munin
@@ -21,3 +25,4 @@ graph_strategy cgi
     end
 out
 %>
+<% end -%>