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 --- templates/macros.j2 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 templates/macros.j2 (limited to 'templates') diff --git a/templates/macros.j2 b/templates/macros.j2 new file mode 100644 index 0000000..d3f755a --- /dev/null +++ b/templates/macros.j2 @@ -0,0 +1,15 @@ +{% macro loop_hosts(group) -%} +{% for h in groups[group] -%} +{% set h = dict(hostvars[h]) %} +{{ caller(h) }} +{%- endfor %} +{%- endmacro %} + +{% macro loop_valid_hosts(group) -%} +{% for h in groups[group] -%} +{% set h = dict(hostvars[h]) %} +{% if h.__ip.external is defined and h.__ip.internal is defined -%} +{{ caller(h) }} +{%- endif %} +{%- endfor %} +{%- endmacro %} -- cgit v1.2.3