aboutsummaryrefslogtreecommitdiff
path: root/tnet
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2024-07-17 20:22:08 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2024-07-17 20:22:08 +0200
commitf69827ab7abf3c62ad6410930b81b3ee137d37b0 (patch)
tree786c44634e638f31fc1a412343c0ab09f2d88902 /tnet
parent43d799e2130bd734bcb4c0a8e6029cd039ea45f5 (diff)
downloadinfra-f69827ab7abf3c62ad6410930b81b3ee137d37b0.tar.gz
infra-f69827ab7abf3c62ad6410930b81b3ee137d37b0.tar.bz2
infra-f69827ab7abf3c62ad6410930b81b3ee137d37b0.tar.xz
infra-f69827ab7abf3c62ad6410930b81b3ee137d37b0.zip
keys
Diffstat (limited to 'tnet')
-rw-r--r--tnet/wg-keys-genkey.yml9
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 }}"