diff options
Diffstat (limited to 'roles/space_server/templates')
-rw-r--r-- | roles/space_server/templates/avahi-hosts.j2 | 16 | ||||
-rw-r--r-- | roles/space_server/templates/dhcpd.conf.j2 | 18 | ||||
-rw-r--r-- | roles/space_server/templates/ipv4.rev.zone.j2 | 8 | ||||
-rw-r--r-- | roles/space_server/templates/s.zone.j2 | 16 |
4 files changed, 29 insertions, 29 deletions
diff --git a/roles/space_server/templates/avahi-hosts.j2 b/roles/space_server/templates/avahi-hosts.j2 index 1e371e6..e64265a 100644 --- a/roles/space_server/templates/avahi-hosts.j2 +++ b/roles/space_server/templates/avahi-hosts.j2 @@ -1,16 +1,16 @@ -{% for host in local_hosts %} -{% if 'mdns' not in host or host.mdns %} -{% if 'ipv4' in host %} -{% for ip in host.ipv4 %} +{% for name, info in local_hosts.items() %} +{% if 'mdns' not in info or info.mdns %} +{% if 'ipv4' in info %} +{% for ip in info.ipv4 %} {% if loop.index <= 1 %} -{{ ip }} {{ host.name }}.local +{{ ip }} {{ name }}.local {% endif %} {% endfor %} {% endif %} -{% if 'ipv6' in host %} -{% for ip in host.ipv6 %} +{% if 'ipv6' in info %} +{% for ip in info.ipv6 %} {% if loop.index <= 1 %} -{{ ip }} {{ host.name }}.local +{{ ip }} {{ name }}.local {% endif %} {% endfor %} {% endif %} diff --git a/roles/space_server/templates/dhcpd.conf.j2 b/roles/space_server/templates/dhcpd.conf.j2 index a2d82a7..13fc3ab 100644 --- a/roles/space_server/templates/dhcpd.conf.j2 +++ b/roles/space_server/templates/dhcpd.conf.j2 @@ -158,17 +158,17 @@ subnet 10.42.3.0 netmask 255.255.255.0 { group { use-host-decl-names on; ddns-updates off; -{% for host in local_hosts %} -{% if 'mac' in host and 'ipv4' in host %} +{% for name, info in local_hosts.items() %} +{% if 'mac' in info and 'ipv4' in info %} -{% if 'description' in host %} - # {{ host.description }} +{% if 'description' in info %} + # {{ info.description }} {% endif %} - host {{ host.name }} { - hardware ethernet {{ host.mac }}; - fixed-address {{ host.ipv4|join(', ') }}; -{% if 'filename' in host %} - filename "{{ host.filename }}"; + host {{ name }} { + hardware ethernet {{ info.mac }}; + fixed-address {{ info.ipv4|join(', ') }}; +{% if 'filename' in info %} + filename "{{ info.filename }}"; {% endif %} } {% endif %} 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 %} 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 %} |