infra/playbooks/roles/wireguard-mesh/templates/inframesh.conf.j2

18 lines
607 B
Plaintext
Raw Permalink Normal View History

2024-03-24 22:51:07 -04:00
[Interface]
Address={{ wireguard_node_ips[inventory_hostname] }}/32
SaveConfig=true
ListenPort={{ wireguard_listen_port }}
PrivateKey={{ wireguard_private_key.stdout }}
{% for peer in groups['wireguard-mesh'] %}
{% 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={{ wireguard_node_ips[peer] }}/32
Endpoint={{ peer | replace('.int.', '.pub.') }}:{{ wireguard_listen_port }}
{% endif %}
{% endfor %}