debian-setup/templates/network/wireguard/default/wg0.netdev.j2
sonny a777228013 Refactor default wireguard setup
- Replaced set_fact based setup with lookup plugin
- Replaced inline definition of credentials with alternative
  systemd file directives
2025-03-01 14:24:13 +01:00

20 lines
426 B
Django/Jinja

# {{ ansible_managed }}
[NetDev]
Name={{ vpn_interface }}
Kind=wireguard
Description=WireGuard tunnel wg0
[WireGuard]
ListenPort={{ vpn_port }}
PrivateKeyFile={{ vpn_server_key_path }}
{% for peer, properties in vpn_peers.items() %}
[WireGuardPeer]
PublicKey={{ properties.public_key }}
PresharedKeyFile={{ properties.preshared_key_path }}
AllowedIPs={{ properties.ip }}/32
{% if not loop.last %}
{% endif %}
{% endfor %}