Matej Focko
4960068555
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>
20 lines
520 B
YAML
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 }}"
|