20 lines
424 B
SYSTEMD
20 lines
424 B
SYSTEMD
[NetDev]
|
|
Name=wg0
|
|
Kind=wireguard
|
|
Description=WireGuard tunnel wg0
|
|
|
|
[WireGuard]
|
|
ListenPort=51871
|
|
PrivateKey={{ wg_private_key }}
|
|
|
|
{% for item in groups['wg0'] %}
|
|
{% if item != inventory_hostname %}
|
|
[WireGuardPeer]
|
|
PublicKey={{ hostvars[item]['wg_public_key'] }}
|
|
PresharedKey={{ hostvars[item]['wg_psk_' ~ inventory_hostname] }}
|
|
AllowedIPs={{ hostvars[item]['wg0_ip'] }}/32
|
|
Endpoint={{ item }}:51871
|
|
|
|
{% endif %}
|
|
{% endfor %}
|