2019-03-19 15:23:12 +01:00
|
|
|
#
|
|
|
|
# {{ ansible_managed }}
|
|
|
|
#
|
|
|
|
{% for network in my_wireguard_networks %}
|
|
|
|
auto wg-{{ network.remote[:11] }}
|
|
|
|
iface wg-{{ network.remote[:11] }}
|
2019-03-24 22:22:19 +01:00
|
|
|
mtu 1420
|
2019-03-25 10:13:01 +01:00
|
|
|
{% if server_type == 'gateway' %}
|
|
|
|
ip-forward on
|
|
|
|
ip6-forward on
|
|
|
|
{% endif %}
|
2019-03-24 18:57:22 +01:00
|
|
|
ipv6-addrgen off
|
2019-03-19 15:23:12 +01:00
|
|
|
{% if magic < network.remote_magic %}
|
|
|
|
address {{ network.ipv4 | ipaddr('ip/prefix') }}
|
|
|
|
address {{ network.ipv6 | ipaddr('ip/prefix') }}
|
|
|
|
{% else %}
|
|
|
|
address {{ network.ipv4 | ipaddr('1') | ipaddr('ip/prefix') }}
|
|
|
|
address {{ network.ipv6 | ipaddr('1') | ipaddr('ip/prefix') }}
|
|
|
|
{% endif %}
|
2019-03-24 22:22:19 +01:00
|
|
|
address {{ 'fe80::/64' | ipaddr(magic) | ipaddr('ip/prefix') }}
|
2019-03-19 15:23:12 +01:00
|
|
|
pre-up ip link add dev $IFACE type wireguard
|
|
|
|
pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf
|
|
|
|
post-up ip link set up dev $IFACE
|
|
|
|
post-down ip link del $IFACE
|
|
|
|
|
|
|
|
{% endfor %}
|