]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/roles/templates/static-master-authorized_keys.erb
Also sources can ssh to the master to trigger stuff
[dsa-puppet.git] / modules / roles / templates / static-master-authorized_keys.erb
1 ##
2 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
3 ##
4
5 <%=
6 def getstaticsynckey(host)
7     key = nil
8     begin
9         facts = YAML.load(File.open("/var/lib/puppet/yaml/facts/#{host}.yaml").read)
10         return facts.values['staticsync_key']
11     rescue Exception => e
12     end
13     return key
14 end
15
16 mirrors = []
17 scope.lookupvar('site::localinfo').keys.sort.each do |node|
18     if scope.lookupvar('site::localinfo')[node]['static_mirror'] or scope.lookupvar('site::localinfo')[node]['static_source']
19         key = getstaticsynckey(node)
20         mirrors << { 'node' => node, 'addr' => scope.lookupvar('site::allnodeinfo')[node]['ipHostNumber'], 'key' => key}
21     end
22 end
23
24
25 lines = []
26 for m in mirrors:
27     lines << '# ' + m['node']
28     if m['key'].nil?
29         lines << "# no key for node"
30     else
31         lines << "command=\"/usr/local/bin/static-master-ssh-wrap #{m['node']}\"," +
32                  'no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-user-rc,' +
33                  'from="' + m['addr'].join(',') + '" ' +
34                  m['key']
35     end
36 end
37
38 lines.join("\n")
39 # vim:set et:
40 # vim:set sts=4 ts=4:
41 # vim:set shiftwidth=4:
42 %>