dotfiles/roles/wg/tasks/generate_keypair.yml
Matej Focko b49b5a3e91
fix(wg): improve generation of keypairs
Signed-off-by: Matej Focko <me@mfocko.xyz>
2024-11-20 18:13:02 +01:00

20 lines
504 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