X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/d67b78773673b939831588836bee081d1360fd3c..7f5c025954a0868b7ac2aea8722089e75c39668e:/cookbooks/networking/templates/default/wireguard.network.erb diff --git a/cookbooks/networking/templates/default/wireguard.network.erb b/cookbooks/networking/templates/default/wireguard.network.erb index 636f2867a..5e215b184 100644 --- a/cookbooks/networking/templates/default/wireguard.network.erb +++ b/cookbooks/networking/templates/default/wireguard.network.erb @@ -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 -%>