diff options
author | Emil Renner Berthing <esmil@labitat.dk> | 2021-09-27 13:28:26 +0200 |
---|---|---|
committer | Emil Renner Berthing <esmil@labitat.dk> | 2021-09-27 13:29:19 +0200 |
commit | 876be1edaf9758bf35ec8b1f73fb32aa4ceaaa21 (patch) | |
tree | 02845c0cdcaca9ab687232f80518ef27aaf19171 /roles/space_server/templates/s.zone.j2 | |
parent | cbc58b7e78595341fec445e8a573b5715de2d83e (diff) | |
download | labitat-ansible-876be1edaf9758bf35ec8b1f73fb32aa4ceaaa21.tar.gz labitat-ansible-876be1edaf9758bf35ec8b1f73fb32aa4ceaaa21.tar.xz labitat-ansible-876be1edaf9758bf35ec8b1f73fb32aa4ceaaa21.zip |
space_server: vars: use dictionary for local_hosts
This allows us to look up info on specific hosts without searching
through the whole list.
Diffstat (limited to 'roles/space_server/templates/s.zone.j2')
-rw-r--r-- | roles/space_server/templates/s.zone.j2 | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/roles/space_server/templates/s.zone.j2 b/roles/space_server/templates/s.zone.j2 index a392f3d..0394e98 100644 --- a/roles/space_server/templates/s.zone.j2 +++ b/roles/space_server/templates/s.zone.j2 @@ -8,17 +8,17 @@ labitrack.s. 600 IN A 185.38.175.70 labitrack.s. 600 IN AAAA 2a01:4262:1ab::cafe track.s. 600 IN A 185.38.175.70 track.s. 600 IN AAAA 2a01:4262:1ab::cafe -{% for host in local_hosts %} -{% if 'ipv4' in host or 'ipv6' in host %} +{% for name, info in local_hosts.items() %} +{% if 'ipv4' in info or 'ipv6' in info %} -{% if 'ipv4' in host %} -{% for ip in host.ipv4 %} -{{ host.name }}.s. 600 IN A {{ ip }} +{% if 'ipv4' in info %} +{% for ip in info.ipv4 %} +{{ name }}.s. 600 IN A {{ ip }} {% endfor %} {% endif %} -{% if 'ipv6' in host %} -{% for ip in host.ipv6 %} -{{ host.name }}.s. 600 IN AAAA {{ ip }} +{% if 'ipv6' in info %} +{% for ip in info.ipv6 %} +{{ name }}.s. 600 IN AAAA {{ ip }} {% endfor %} {% endif %} {% endif %} |