0
0
wireguard-mesh-network-role/templates/wg0.conf.j2

18 lines
570 B
Plaintext
Raw Normal View History

2023-11-08 01:13:53 +08:00
[Interface]
ListenPort={{ wireguard_port }}
PrivateKey={{ wireguard_private_key.stdout }}
Address={{ wireguard_ip }}
MTU = 1280
{% for peer in groups['all'] %}
{% if peer != inventory_hostname %}
[Peer]
PublicKey={{ hostvars[peer].wireguard_public_key.stdout }}
PresharedKey={{ wireguard_preshared_keys[peer] if inventory_hostname < peer else hostvars[peer].wireguard_preshared_keys[inventory_hostname] }}
AllowedIPs={{ hostvars[peer].wireguard_ip }}/32
Endpoint={{ hostvars[peer].ansible_host }}:{{ wireguard_port }}
PersistentKeepalive = 25
{% endif %}
{% endfor %}