]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blobdiff - modules/profile/templates/wireguard/network.conf.erb
Add wireguard to host_ldap
[perso/Immae/Projets/Puppet.git] / modules / profile / templates / wireguard / network.conf.erb
index 0528050ca89ff5b5b7f81b2e9384dab0f8c95d8c..5327dfd305744c131ef445aae5a8c1c4243bb579 100644 (file)
@@ -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 -%>