From bbd0992473b54b2982e1f890840bfa2624abcb20 Mon Sep 17 00:00:00 2001 From: Robin Sonnabend <robin@fsmpi.rwth-aachen.de> Date: Tue, 1 Sep 2020 18:01:34 +0200 Subject: [PATCH] =?UTF-8?q?{{=E2=80=A6}}=20->=20{{=20=E2=80=A6=20}}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wireguard/handlers/main.yml | 4 ++-- wireguard/tasks/main.yml | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/wireguard/handlers/main.yml b/wireguard/handlers/main.yml index 71b65f1..f19c21a 100644 --- a/wireguard/handlers/main.yml +++ b/wireguard/handlers/main.yml @@ -2,6 +2,6 @@ - name: restart wireguard systemd: - name: "wg-quick@{{item.key}}.service" + name: "wg-quick@{{ item.key }}.service" state: restarted - with_dict: "{{wireguard_interfaces}}" + with_dict: "{{ wireguard_interfaces }}" diff --git a/wireguard/tasks/main.yml b/wireguard/tasks/main.yml index c7086bb..62da7ca 100644 --- a/wireguard/tasks/main.yml +++ b/wireguard/tasks/main.yml @@ -1,44 +1,44 @@ --- - name: ensure wireguard is installed - include_tasks: "install-{{ansible_facts['os_family']}}.yml" + include_tasks: "install-{{ ansible_facts['os_family'] }}.yml" - name: ensure we have a private key shell: - cmd: "wg genkey | tee {{item.key}}.key | wg pubkey > {{item.key}}.pub" + cmd: "wg genkey | tee {{ item.key }}.key | wg pubkey > {{ item.key }}.pub" chdir: /etc/wireguard - creates: "/etc/wireguard/{{item.key}}.key" - with_dict: "{{wireguard_interfaces}}" + creates: "/etc/wireguard/{{ item.key }}.key" + with_dict: "{{ wireguard_interfaces }}" notify: - restart wireguard no_log: true - name: get the pubkey slurp: - src: "/etc/wireguard/{{item.key}}.pub" + src: "/etc/wireguard/{{ item.key }}.pub" register: pubkeys - with_dict: "{{wireguard_interfaces}}" + with_dict: "{{ wireguard_interfaces }}" - name: store the pubkey in facts set_fact: # yamllint disable-line rule:line-length - wireguard_pubkeys: "{{dict(pubkeys.results|map(attribute='item')|map(attribute='key') | zip(pubkeys.results|map(attribute='content')|map('b64decode')|map('trim')))}}" + wireguard_pubkeys: "{{ dict(pubkeys.results|map(attribute='item')|map(attribute='key') | zip(pubkeys.results|map(attribute='content')|map('b64decode')|map('trim'))) }}" cacheable: true - name: configure wireguard template: src: wireguard.conf.j2 - dest: /etc/wireguard/{{item.key}}.conf + dest: /etc/wireguard/{{ item.key }}.conf owner: root group: root mode: '0600' - with_dict: "{{wireguard_interfaces}}" + with_dict: "{{ wireguard_interfaces }}" notify: - restart wireguard - name: enable interface systemd: - name: "wg-quick@{{item.key}}.service" + name: "wg-quick@{{ item.key }}.service" state: started enabled: true - with_dict: "{{wireguard_interfaces}}" + with_dict: "{{ wireguard_interfaces }}" -- GitLab