]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/exim/templates/manualroute.erb
Move all roles from local.yaml to hiera
[dsa-puppet.git] / modules / exim / templates / manualroute.erb
1 ##
2 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
3 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
4 ##
5 ## Format:
6 ## domain: hostname[::port] options
7 ## example:
8 ## buildd.debian.org: grieg.debian.org::587 byname
9
10 <%=
11 mxmatches = [ scope.lookupvar('::fqdn') ]
12 routes = []
13 extraroutes = []
14
15 if scope.function_has_role('mailrelay')
16   mxmatches << 'mailout.debian.org'
17   mxmatches << 'INCOMING-MX'
18   extraroutes = [ "keyring.debian.org:\t\tkaufmann.debian.org" ]
19   extraroutes << "www-master.debian.org:\t\twolkenstein.debian.org"
20 end
21
22 mxregex = Regexp.new('^\d+\s+(.*?)\.?$')
23 scope.lookupvar('site::allnodeinfo').keys.sort.each do |host|
24   next unless scope.lookupvar('site::allnodeinfo')[host]['mXRecord']
25   scope.lookupvar('site::allnodeinfo')[host]['mXRecord'].each do |mx|
26     mxmatch = mxregex.match(mx)
27     if mxmatches.include?(mxmatch[1])
28       route = host + ":\t\t" + host
29       if scope.lookupvar('site::localinfo').has_key?(host) and scope.lookupvar('site::localinfo')[host].has_key?('mail_port') and scope.lookupvar('site::localinfo')[host]['mail_port'].to_s != ''
30         route += "::" + scope.lookupvar('site::localinfo')[host]['mail_port'].to_s
31       end
32       routes << route
33     end
34   end
35 end
36
37 routes << extraroutes
38
39 routes.join("\n")
40 %>