# managed by Ansible {% import 'macros.j2' as macros with context %} {% call(h) macros.loop_valid_hosts("all") %} {% set command = "pgrep wg && ! ping -c 1 -w 1 %s" % h.__ip.external %} Match originalHost {{ h.inventory_hostname }} exec "{{ command }}" HostName {{ h.__ip.internal }} Match originalHost {{ h.inventory_hostname }} HostName {{ h.__ip.external }} {% endcall %}