]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blobdiff - modules/profile/templates/wireguard/network.conf.erb
Merge branch 'file_store' into dev
[perso/Immae/Projets/Puppet.git] / modules / profile / templates / wireguard / network.conf.erb
diff --git a/modules/profile/templates/wireguard/network.conf.erb b/modules/profile/templates/wireguard/network.conf.erb
new file mode 100644 (file)
index 0000000..5327dfd
--- /dev/null
@@ -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 -%>