mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
Why the interface is reconfigured in place rather than restarted is recorded in requirement 037; the task file only has to do it.
23 lines
739 B
YAML
23 lines
739 B
YAML
---
|
|
- name: "🔍 Check whether '{{ mesh_name }}' is already up"
|
|
ansible.builtin.command: "wg show {{ mesh_name | quote }}"
|
|
register: wireguard_present
|
|
changed_when: false
|
|
failed_when: false
|
|
|
|
- name: "🔺 Bring '{{ mesh_name }}' up"
|
|
ansible.builtin.command: "wg-quick up {{ mesh_name | quote }}"
|
|
register: wireguard_up
|
|
changed_when: wireguard_up.rc == 0
|
|
when: wireguard_present.rc != 0
|
|
|
|
- name: "♻️ Reconfigure the live '{{ mesh_name }}' in place"
|
|
ansible.builtin.shell: >
|
|
set -o pipefail && wg syncconf {{ mesh_name | quote }}
|
|
<(wg-quick strip {{ mesh_name | quote }})
|
|
args:
|
|
executable: /bin/bash
|
|
register: wireguard_synced
|
|
changed_when: wireguard_synced.rc == 0
|
|
when: wireguard_present.rc == 0
|