aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-12-05 13:07:49 +0000
committerRomain Gonçalves <me@rgoncalves.se>2021-12-05 21:03:22 +0000
commita0dd74445b4460e5e7fa4c72bd478348eb960224 (patch)
treef8887dff286c7d39c8c49c62e2969d87a4235f0e /templates
parent28c76a43c348456af3d1508c88c73edaa059735c (diff)
downloadrules-a0dd74445b4460e5e7fa4c72bd478348eb960224.tar.gz
roles/workstation: Generate hostnames for ssh
Diffstat (limited to 'templates')
-rw-r--r--templates/macros.j215
1 files changed, 15 insertions, 0 deletions
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 %}
remember that computers suck.