From a0dd74445b4460e5e7fa4c72bd478348eb960224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Sun, 5 Dec 2021 13:07:49 +0000 Subject: roles/workstation: Generate hostnames for ssh --- roles/workstation/templates/ssh.config.j2 | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 roles/workstation/templates/ssh.config.j2 (limited to 'roles/workstation/templates/ssh.config.j2') diff --git a/roles/workstation/templates/ssh.config.j2 b/roles/workstation/templates/ssh.config.j2 new file mode 100644 index 0000000..2915a1a --- /dev/null +++ b/roles/workstation/templates/ssh.config.j2 @@ -0,0 +1,11 @@ +# 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 %} -- cgit v1.2.3