From 6a71faa3078857239bcb82d1b3dfce3d15e157f6 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 11 Oct 2022 09:48:42 +0200 Subject: [PATCH] fix linting --- tasks/main.yml | 6 +++--- templates/etc/wireguard/wg.conf.j2 | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 3935fb8..3d16fc5 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -17,9 +17,9 @@ - name: Generate WireGuard private key command: "wg genkey" register: __wireguard_private_key_gen - changed_when: false + changed_when: False - - name: Set private key fact + - name: Set generated private key set_fact: wireguard_private_key: "{{ __wireguard_private_key_gen.stdout }}" when: @@ -34,7 +34,7 @@ src: "/etc/wireguard/{{ wireguard_interface }}.conf" register: __wireguard_config - - name: Set private key fact + - name: Set existing private key set_fact: wireguard_private_key: "{{ __wireguard_config['content'] | b64decode | regex_findall('PrivateKey = (.*)') | first }}" when: diff --git a/templates/etc/wireguard/wg.conf.j2 b/templates/etc/wireguard/wg.conf.j2 index c1ec85d..7ca6cf4 100644 --- a/templates/etc/wireguard/wg.conf.j2 +++ b/templates/etc/wireguard/wg.conf.j2 @@ -52,7 +52,7 @@ AllowedIPs = {{ hostvars[host].wireguard_address.split('/')[0] }}/32 {% if hostvars[host].wireguard_persistent_keepalive is defined %} PersistentKeepalive = {{ hostvars[host].wireguard_persistent_keepalive }} {% endif %} -{% if hostvars[host].wireguard_endpoint is not defined or hostvars[host].wireguard_endpoint != "" %} +{% if hostvars[host].wireguard_endpoint is not defined or not hostvars[host].wireguard_endpoint %} Endpoint = {{ hostvars[host].wireguard_endpoint | default(host) }}:{{ hostvars[host].wireguard_port | default(wireguard_port) }} {% endif %} {% endif %}