Group/host variable refactor

This commit is contained in:
Sonny Bakker 2025-03-15 00:05:30 +01:00
parent eb308670cc
commit 4b8aaf3e95
78 changed files with 445 additions and 374 deletions

View file

@ -0,0 +1,24 @@
# {{ ansible_managed }}
[NetDev]
Name={{ vpn_default.interface }}
Kind=wireguard
Description=WireGuard tunnel {{ vpn_default.interface }}
[WireGuard]
PrivateKeyFile={{ vpn_default.private_key_path }}
{% for peer in vpn_default.peers %}
[WireGuardPeer]
PublicKey={{ peer.public_key }}
PresharedKeyFile={{ peer.preshared_key_path }}
{% for ip in peer.allowed_ips %}
AllowedIPs={{ ip.address }}
{% endfor %}
{% if peer.endpoint %}
Endpoint={{ peer.endpoint }}
{% endif %}
{% if not loop.last %}
{% endif %}
{% endfor %}

View file

@ -0,0 +1,19 @@
# {{ ansible_managed }}
[Match]
Name={{ vpn_default.interface }}
[Network]
Address={{ vpn_default.ip }}/{{ vpn_default.prefix }}
DNS={{ vpn_default.dns }}
Domains={{ vpn_default.domains | join(' ') }}
{% for peer in vpn_default.peers %}
{% for ip in peer.allowed_ips %}
{% if ip.create_route %}
[Route]
Destination={{ ip.address }}
Scope=link
{% endif %}
{% endfor %}
{% endfor %}

View file

@ -0,0 +1,24 @@
# {{ ansible_managed }}
[NetDev]
Name={{ vpn_media.interface }}
Kind=wireguard
Description=WireGuard tunnel {{ vpn_media.interface }}
[WireGuard]
PrivateKeyFile={{ vpn_media.private_key_path }}
{% for peer in vpn_media.peers %}
[WireGuardPeer]
PublicKey={{ peer.public_key }}
PresharedKeyFile={{ peer.preshared_key_path }}
{% for ip in peer.allowed_ips %}
AllowedIPs={{ ip.address }}
{% endfor %}
{% if peer.endpoint %}
Endpoint={{ peer.endpoint }}
{% endif %}
{% if not loop.last %}
{% endif %}
{% endfor %}

View file

@ -0,0 +1,19 @@
# {{ ansible_managed }}
[Match]
Name={{ vpn_media.interface }}
[Network]
Address={{ vpn_media.ip }}/{{ vpn_media.prefix }}
DNS={{ vpn_media.dns }}
Domains={{ vpn_media.domains | join(' ') }}
{% for peer in vpn_media.peers %}
{% for ip in peer.allowed_ips %}
{% if ip.create_route %}
[Route]
Destination={{ ip.address }}
Scope=link
{% endif %}
{% endfor %}
{% endfor %}

View file

@ -0,0 +1,5 @@
[Match]
Name=wlan0
[Network]
DHCP=ipv4