{% for host in groups["servers"] %} {% set host = hostvars[host] %} Match originalhost dcontroller exec "systemctl is-active wg-quick@{{ _i.dcontroller }}.service" HostName {{ host.ip.inbound }} Port {{ host.services.tcp.ssh }} Match originalhost {{ host.ansible_host }} HostName {{ host.ip.outbound }} Port {{ host.services.tcp.ssh }} User root {% endfor %}