X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprofile%2Ftemplates%2Fwireguard%2Fnetwork.conf.erb;fp=modules%2Fprofile%2Ftemplates%2Fwireguard%2Fnetwork.conf.erb;h=5327dfd305744c131ef445aae5a8c1c4243bb579;hb=6667f52e8017065c9b5f14c8025458b38029a800;hp=0000000000000000000000000000000000000000;hpb=19c467dccfd00193a66f1341f068987da7bca14b;p=perso%2FImmae%2FProjets%2FPuppet.git diff --git a/modules/profile/templates/wireguard/network.conf.erb b/modules/profile/templates/wireguard/network.conf.erb new file mode 100644 index 0000000..5327dfd --- /dev/null +++ b/modules/profile/templates/wireguard/network.conf.erb @@ -0,0 +1,19 @@ +[Interface] +<%- @ips.each do |ip| -%> +Address = <%= ip %> +<%- end -%> +PrivateKey = <%= @private_key %> +ListenPort = 51820 + +<%- @facts["ldapvar"]["other"].each do |host| -%> +<%- if (host["vars"]["wireguard_public"] || []).count > 0 %> +[Peer] +# <%= 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 -%>