From 876be1edaf9758bf35ec8b1f73fb32aa4ceaaa21 Mon Sep 17 00:00:00 2001 From: Emil Renner Berthing Date: Mon, 27 Sep 2021 13:28:26 +0200 Subject: space_server: vars: use dictionary for local_hosts This allows us to look up info on specific hosts without searching through the whole list. --- roles/space_server/templates/ipv4.rev.zone.j2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'roles/space_server/templates/ipv4.rev.zone.j2') diff --git a/roles/space_server/templates/ipv4.rev.zone.j2 b/roles/space_server/templates/ipv4.rev.zone.j2 index 1736333..0c165de 100644 --- a/roles/space_server/templates/ipv4.rev.zone.j2 +++ b/roles/space_server/templates/ipv4.rev.zone.j2 @@ -1,11 +1,11 @@ 42.10.in-addr.arpa. 600 IN SOA space.labitat.dk. esmil.labitat.dk. 2019040101 7200 3600 604800 86400 42.10.in-addr.arpa. 600 IN NS space.labitat.dk. -{% for host in local_hosts %} -{% if 'ipv4' in host %} -{% for ip in host.ipv4 %} +{% for name, info in local_hosts.items() %} +{% if 'ipv4' in info %} +{% for ip in info.ipv4 %} {% if ip.startswith('10.42.') %} -{{ ip.split('.')[3] }}.{{ ip.split('.')[2] }}.42.10.in-addr.arpa. 600 IN PTR {{ host.name }}.s. +{{ ip.split('.')[3] }}.{{ ip.split('.')[2] }}.42.10.in-addr.arpa. 600 IN PTR {{ name }}.s. {% endif %} {% endfor %} {% endif %} -- cgit v1.2.1