2024-11-20 18:13:02 +01:00
|
|
|
---
|
|
|
|
- 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:
|
2024-12-22 20:30:55 +01:00
|
|
|
wg_private_key: "{{ _generated_private_key.stdout }}"
|
|
|
|
wg_public_key: "{{ _derived_public_key.stdout }}"
|