From 1e694c3769a216e102bd7bda86f721a336c823a2 Mon Sep 17 00:00:00 2001 From: lhahn Date: Sat, 2 Sep 2023 17:14:51 +0200 Subject: [PATCH] fix wireguard --- handlers/main.yml | 6 ++++++ templates/etc/wireguard/wireguard.conf.j2 | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index ed97d53..ee6d4f6 100755 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1 +1,7 @@ --- +- name: restart wireguard service + service: + name: wg-quick@{{ cloud_name }} + state: restarted + enabled: yes + when: wireguard_installed is defined and not wireguard_installed.changed \ No newline at end of file diff --git a/templates/etc/wireguard/wireguard.conf.j2 b/templates/etc/wireguard/wireguard.conf.j2 index 909d8d4..00290fb 100644 --- a/templates/etc/wireguard/wireguard.conf.j2 +++ b/templates/etc/wireguard/wireguard.conf.j2 @@ -16,10 +16,10 @@ PreUp = iptables -t nat -A POSTROUTING -o {{ cloud_name }} -j MASQUERADE PostDown = iptables -t nat -D POSTROUTING -o {{ cloud_name }} -j MASQUERADE {% endif %} -{% for client in vpn_clients %} -## vpn {{ cloud_name }} - {{ client }} ## +{% for vpn_client in vpn_clients %} +## vpn {{ cloud_name }} - {{ vpn_client }} ## [Peer] -PublicKey = {{ vpn_clients[client].public_key }} -AllowedIPs = {{ vpn_gateway_net_prefix }}.{{ vpn_clients[client].index }}/32 +PublicKey = {{ vpn_client.public_key }} +AllowedIPs = {{ vpn_gateway_net_prefix }}.{{ vpn_client.index }}/32 {% endfor %} \ No newline at end of file