]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/networking/templates/default/wireguard.network.erb
Remove roles for fuchur, glaedr, gorwen, idris and lockheed
[chef.git] / cookbooks / networking / templates / default / wireguard.network.erb
index 636f2867affb650d163a3d04015ea6a5e2794165..5e215b18401b960d31141281148070210635cf3b 100644 (file)
@@ -2,7 +2,22 @@
 Name=wg0
 
 [Network]
+<% if node.internal_ipaddress -%>
+Address=<%= node.internal_ipaddress %>/32
+<% end -%>
+<% if node[:networking][:private_address] -%>
+Address=<%= node[:networking][:private_address] %>/32
+<% end -%>
 Address=<%= node[:networking][:wireguard][:address] %>/128
 
 [Route]
 Destination=fd43:e709:ea6d:1::/64
+<% node[:networking][:wireguard][:peers].each do |peer| -%>
+<% Array(peer[:allowed_ips]).sort.each do |ip| -%>
+<% unless ip =~ /^fd43:e709:ea6d:1::/ -%>
+
+[Route]
+Destination=<%= ip %>
+<% end -%>
+<% end -%>
+<% end -%>