if getfromhash($site::nodeinfo, 'weblog_provider') {
include roles::weblog_provider
}
+ if $::hostname in [ravel] {
+ include roles::weblog_destination
+ }
}
--- /dev/null
+class roles::weblog_destination {
+ file { '/etc/ssh/userkeys/weblogsync':
+ content => template('roles/weblog_destination-authorized_keys.erb'),
+ }
+}
--- /dev/null
+##
+## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
+##
+
+<%=
+def getweblogsynckey(host)
+ key = nil
+ begin
+ facts = YAML.load(File.open("/var/lib/puppet/yaml/facts/#{host}.yaml").read)
+ return facts.values['weblogsync_key']
+ rescue Exception => e
+ end
+ return key
+end
+
+localinfo = scope.lookupvar('site::localinfo')
+allnodeinfo = scope.lookupvar('site::allnodeinfo')
+
+mirrors = []
+localinfo.keys.sort.each do |node|
+ if localinfo[node]['weblog_provider']
+ key = getstaticsynckey(node)
+ mirrors << { 'node' => node, 'addr' => allnodeinfo[node]['ipHostNumber'], 'key' => key}
+ end
+end
+
+lines = []
+for m in mirrors:
+ lines << '# ' + m['node']
+ if m['key'].nil?
+ lines << "# no key for node"
+ else
+ lines << "command=\"/srv/weblogs.debian.org/bin/ssh-wrap #{m['node']}\"," +
+ 'no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-user-rc,' +
+ 'from="' + m['addr'].join(',') + '" ' +
+ m['key']
+ end
+end
+
+lines.join("\n")
+# vim:set et:
+# vim:set sts=4 ts=4:
+# vim:set shiftwidth=4:
+%>