Files
2026-07-08 16:38:55 +01:00

40 lines
1.1 KiB
Django/Jinja

# {{ item.description | default(item.name) }}
[Interface]
{% if item.private_key is defined %}
PrivateKey = {{ item.private_key }}
{% else %}
PrivateKey = {{ lookup('ansible.builtin.env', item.private_key_env) }}
{% endif %}
Address = {{ item.address | join(',') }}
{% if item.listen_port is defined %}
ListenPort = {{ item.listen_port }}
{% endif %}
{% if item.mtu is defined %}
MTU = {{ item.mtu }}
{% endif %}
{% for command in item.pre_up | default([]) %}
PreUp = {{ command }}
{% endfor %}
{% for command in item.post_up | default([]) %}
PostUp = {{ command }}
{% endfor %}
{% for command in item.pre_down | default([]) %}
PreDown = {{ command }}
{% endfor %}
{% for command in item.post_down | default([]) %}
PostDown = {{ command }}
{% endfor %}
{% for peer in item.peers | default([]) %}
[Peer]
PublicKey = {{ peer.public_key }}
AllowedIPs = {{ peer.allowed_ips | join(',') }}
{% if peer.endpoint is defined %}
Endpoint = {{ peer.endpoint }}
{% endif %}
{% if peer.persistent_keepalive is defined %}
PersistentKeepalive = {{ peer.persistent_keepalive }}
{% endif %}
{% endfor %}