From f69827ab7abf3c62ad6410930b81b3ee137d37b0 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 17 Jul 2024 20:22:08 +0200 Subject: keys --- tnet/wg-keys-genkey.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tnet') diff --git a/tnet/wg-keys-genkey.yml b/tnet/wg-keys-genkey.yml index fe0e976..c974a1d 100644 --- a/tnet/wg-keys-genkey.yml +++ b/tnet/wg-keys-genkey.yml @@ -1,5 +1,8 @@ - set_fact: - priv: "{{ lookup('community.sops.sops', 'keys/wg-{{ inventory_hostname }}-{{ item.key }}.sops.key', empty_on_not_exist=true) }}" + key: "keys/wg-{{ inventory_hostname }}-{{ item.key }}.sops.key" + pub: "keys/wg-{{ inventory_hostname }}-{{ item.key }}.pub" +- set_fact: + priv: "{{ lookup('community.sops.sops', key, empty_on_not_exist=true) }}" - when: priv == "" block: - name: wg genkey @@ -17,10 +20,10 @@ - name: Save Wireguard key community.sops.sops_encrypt: - path: "keys/wg-{{ inventory_hostname }}-{{ item.key }}.sops.key" + path: "{{ key }}" content_text: "{{ new_priv.stdout }}" - name: Save Wireguard public key copy: - dest: "keys/wg-{{ inventory_hostname }}-{{ item.key }}.pub" + dest: "{{ pub }}" content: "{{ new_pub.stdout }}" -- cgit v1.2.3