dotfiles/roles/wg/tasks/generate_keypair.yml

21 lines
520 B
YAML
Raw Normal View History

---
- 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 }}"