remove olin from bmdb1 access
[mirror/dsa-puppet.git] / modules / ipsec / templates / ipsec.conf-10-puppet-peers.conf.erb
1 ##
2 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
3 ##
4
5 <%=
6
7 lines = []
8
9 config = YAML.load(@ipsec_config)
10
11 unless config.keys.include?(@fqdn) then
12   fail("Host #{@fqdn} not found in ipsec config.")
13 end
14
15 config.keys.each do |host|
16   next if @fqdn == host
17
18   pair = [@fqdn, host]
19   pair.sort!
20   connname = pair.join('-')
21
22   lines << "conn #{connname}"
23   lines << "  # left is us (local): #{@fqdn}"
24   lines << "  left       = #{config[@fqdn]['address']}"
25
26   lines << "  # right is our peer (remote): #{host}"
27   lines << "  right       = #{config[host]['address']}"
28
29   if config[@fqdn].include?('subnet') or config[host].include?('subnet')
30     lines << "  type = tunnel"
31     if config[@fqdn].include?('subnet')
32       lines << "  leftsubnet = #{config[@fqdn]['subnet'].join(', ')}"
33     end
34     if config[host].include?('subnet')
35       lines << "  rightsubnet = #{config[host]['subnet'].join(', ')}"
36     end
37   else
38     lines << "  type = transport"
39   end
40   lines << ""
41   lines << "  #auto=start"
42   lines << "  #closeaction=restart"
43   lines << "  auto=route"
44   lines << ""
45 end
46 lines.join("\n")
47
48 %>