aboutsummaryrefslogtreecommitdiff
path: root/modules/profile/templates/wireguard/network.conf.erb
blob: 5327dfd305744c131ef445aae5a8c1c4243bb579 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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 -%>