X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FPuppet.git;a=blobdiff_plain;f=modules%2Fprofile%2Ftemplates%2Fwireguard%2Fnetwork.conf.erb;h=5327dfd305744c131ef445aae5a8c1c4243bb579;hp=0528050ca89ff5b5b7f81b2e9384dab0f8c95d8c;hb=cfad76106ad85e170c08a196e7e365a78293aa7c;hpb=a7b985dd3cc4af68875733eb135335a31504f472 diff --git a/modules/profile/templates/wireguard/network.conf.erb b/modules/profile/templates/wireguard/network.conf.erb index 0528050..5327dfd 100644 --- a/modules/profile/templates/wireguard/network.conf.erb +++ b/modules/profile/templates/wireguard/network.conf.erb @@ -1,13 +1,19 @@ [Interface] -<%- @ips.each do |ip| %> +<%- @ips.each do |ip| -%> Address = <%= ip %> -<% end -%> +<%- end -%> PrivateKey = <%= @private_key %> +ListenPort = 51820 <%- @facts["ldapvar"]["other"].each do |host| -%> <%- if (host["vars"]["wireguard_public"] || []).count > 0 %> [Peer] -PublicKey = host["vars"]["wireguard_public"][0] +# <%= host["vars"]["real_hostname"][0] %> +PublicKey = <%= host["vars"]["wireguard_public"][0] %> +<%- if (host["vars"]["wireguard_ip"] || []).count > 0 -%> +AllowedIps = <%= host["vars"]["wireguard_ip"].join(", ").gsub /\/\d+/, "/32" %> +<%- end -%> +Endpoint = <%= host["vars"]["real_hostname"][0] %>:51820 <% end -%> <%- end -%>