6 <% if node[:lsb][:release].to_f < 20.04 -%>
7 PrivateKey=<%= IO.read("/var/lib/systemd/wireguard/private.key").chomp %>
9 PrivateKeyFile=/var/lib/systemd/wireguard/private.key
12 <% node[:networking][:wireguard][:peers].each do |peer| -%>
15 PublicKey=<%= peer[:public_key] %>
16 <% if node[:lsb][:release].to_f < 20.04 -%>
17 PresharedKey=<%= IO.read("/var/lib/systemd/wireguard/preshared.key").chomp %>
19 PresharedKeyFile=/var/lib/systemd/wireguard/preshared.key
21 AllowedIPs=<%= Array(peer[:allowed_ips]).sort.join(",") %>
22 <% if peer[:endpoint] -%>
23 Endpoint=<%= peer[:endpoint] %>
25 <% if node[:networking][:wireguard][:keepalive] -%>
26 PersistentKeepalive=<%= node[:networking][:wireguard][:keepalive] %>