]> git.openstreetmap.org Git - chef.git/blob - cookbooks/networking/templates/default/wireguard.network.erb
Handle machines with no external interface
[chef.git] / cookbooks / networking / templates / default / wireguard.network.erb
1 [Match]
2 Name=wg0
3
4 [Network]
5 <% if node.internal_ipaddress -%>
6 Address=<%= node.internal_ipaddress %>/32
7 <% end -%>
8 <% if node[:networking][:private_address] -%>
9 Address=<%= node[:networking][:private_address] %>/32
10 <% end -%>
11 Address=<%= node[:networking][:wireguard][:address] %>/128
12
13 [Route]
14 Destination=fd43:e709:ea6d:1::/64
15 <% node[:networking][:wireguard][:peers].sort_by { |p| p[:public_key] }.each do |peer| -%>
16 <% Array(peer[:allowed_ips]).sort.each do |ip| -%>
17 <% unless ip =~ /^fd43:e709:ea6d:1::/ -%>
18
19 [Route]
20 Destination=<%= ip %>
21 <% end -%>
22 <% end -%>
23 <% end -%>