Fix playbook check if delegate_to host is accessible

This commit is contained in:
Raphael Dannecker 2025-05-07 13:32:17 +02:00
parent 233e8e4ecf
commit dfb9cf5ee7
2 changed files with 6 additions and 6 deletions

View file

@ -5,7 +5,7 @@
- wireguard
- name: Check if wg_server is reachable
ansible.builtin.command: echo "Test if wg_server is reachable"
ansible.builtin.command: echo "reachable"
delegate_to: wireguard_server
register: result
changed_when: false
@ -17,10 +17,10 @@
* server not reachable
* no matching ssh-key
changed_when: true
when: result.unreachable is defined and result.unreachable
when: result.stdout is not defined or result.stdout!="reachable"
- name: Configure WG Server
when: result.unreachable is not defined or not result.unreachable
when: result.stdout is defined and result.stdout=="reachable"
block:
- name: Set facts wg_clientname
ansible.builtin.set_fact: