diff options
Diffstat (limited to 'tnet')
-rw-r--r-- | tnet/wg-keys-genkey.yml | 9 |
1 files changed, 6 insertions, 3 deletions
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 }}" |