From 5dd380bcf1d83cd287efff82172b686c75df8317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=A4rkle?= Date: Mon, 28 Dec 2020 18:21:19 +0100 Subject: [PATCH] Bugfix: Iterating over clients now increment ip numbers ... --- roles/wireguard_server/tasks/main.yml | 4 ++-- roles/wireguard_server/templates/wg0-client.conf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/wireguard_server/tasks/main.yml b/roles/wireguard_server/tasks/main.yml index fd49134..932cef2 100644 --- a/roles/wireguard_server/tasks/main.yml +++ b/roles/wireguard_server/tasks/main.yml @@ -61,11 +61,11 @@ - name: generate client configs template: src: "wg0-client.conf" - dest: "~/wg/{{ item.item }}/wg0-client.conf" + dest: "~/wg/{{ item.1.item }}/wg0-client.conf" owner: root group: root mode: 0600 - with_items: "{{ vpn_client_private_keys.results }}" + with_indexed_items: "{{ vpn_client_private_keys.results }}" - name: generate qr codes for client configs shell: umask 077; qrencode --type=PNG --output=/root/wg/{{ item }}/wg0-client.png < ~/wg/{{ item }}/wg0-client.conf diff --git a/roles/wireguard_server/templates/wg0-client.conf b/roles/wireguard_server/templates/wg0-client.conf index d621a18..90ea3ff 100644 --- a/roles/wireguard_server/templates/wg0-client.conf +++ b/roles/wireguard_server/templates/wg0-client.conf @@ -1,7 +1,7 @@ [Interface] -Address = {{ vpn_network }}.{{item|int + 2}}/32 +Address = {{ vpn_network }}.{{item.0 + 2}}/32 DNS = {{ dns_for_clients }} -PrivateKey = {{ item.stdout }} +PrivateKey = {{ item.1.stdout }} [Peer] PublicKey = {{ vpn_server_public_key.stdout }}