dotfiles/roles/wg/tasks/generate_keypair.yml
Matej Focko 4960068555
fix(wg): correctly template facts
When setting facts to outputs of some other tasks or variables, they need
to be correctly templated and quoted, otherwise they're taken as is,
i.e., as text.

Signed-off-by: Matej Focko <me@mfocko.xyz>
2024-12-22 20:35:23 +01:00

20 lines
520 B
YAML

---
- name: Generate private key
ansible.builtin.command:
cmd: wg genkey
changed_when: false
check_mode: false
register: _generated_private_key
- name: Derive public key
ansible.builtin.command:
cmd: wg pubkey
stdin: "{{ _generated_private_key.stdout }}"
changed_when: false
check_mode: false
register: _derived_public_key
- name: Set key/pair facts
ansible.builtin.set_fact:
wg_private_key: "{{ _generated_private_key.stdout }}"
wg_public_key: "{{ _derived_public_key.stdout }}"