aboutsummaryrefslogtreecommitdiffstats
path: root/roles/space_server/templates
diff options
context:
space:
mode:
Diffstat (limited to 'roles/space_server/templates')
-rw-r--r--roles/space_server/templates/avahi-hosts.j220
-rw-r--r--roles/space_server/templates/dhcpd.conf.j24
-rw-r--r--roles/space_server/templates/s.zone.j210
3 files changed, 21 insertions, 13 deletions
diff --git a/roles/space_server/templates/avahi-hosts.j2 b/roles/space_server/templates/avahi-hosts.j2
index f87ad4b..1e371e6 100644
--- a/roles/space_server/templates/avahi-hosts.j2
+++ b/roles/space_server/templates/avahi-hosts.j2
@@ -1,14 +1,18 @@
{% for host in local_hosts %}
{% if 'mdns' not in host or host.mdns %}
-{% for ip in host.ips | ipv4 %}
-{% if loop.index <= 1 %}
+{% if 'ipv4' in host %}
+{% for ip in host.ipv4 %}
+{% if loop.index <= 1 %}
{{ ip }} {{ host.name }}.local
-{% endif %}
-{% endfor %}
-{% for ip in host.ips | ipv6 %}
-{% if loop.index <= 1 %}
+{% endif %}
+{% endfor %}
+{% endif %}
+{% if 'ipv6' in host %}
+{% for ip in host.ipv6 %}
+{% if loop.index <= 1 %}
{{ ip }} {{ host.name }}.local
-{% endif %}
-{% endfor %}
+{% endif %}
+{% endfor %}
+{% endif %}
{% endif %}
{% endfor %}
diff --git a/roles/space_server/templates/dhcpd.conf.j2 b/roles/space_server/templates/dhcpd.conf.j2
index e071a88..23e08da 100644
--- a/roles/space_server/templates/dhcpd.conf.j2
+++ b/roles/space_server/templates/dhcpd.conf.j2
@@ -105,14 +105,14 @@ subnet 10.42.3.0 netmask 255.255.255.0 {
group {
use-host-decl-names on;
{% for host in local_hosts %}
+{% if 'mac' in host and 'ipv4' in host %}
-{% if 'mac' in host %}
{% if 'description' in host %}
# {{ host.description }}
{% endif %}
host {{ host.name }} {
hardware ethernet {{ host.mac }};
- fixed-address {{ host.ips | first }};
+ fixed-address {{ host.ipv4|join(', ') }};
{% if 'filename' in host %}
filename "{{ host.filename }}";
{% endif %}
diff --git a/roles/space_server/templates/s.zone.j2 b/roles/space_server/templates/s.zone.j2
index 6bf9718..a392f3d 100644
--- a/roles/space_server/templates/s.zone.j2
+++ b/roles/space_server/templates/s.zone.j2
@@ -9,13 +9,17 @@ 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 %}
-{% if 'ips' in host and host.ips|length > 0 %}
-{% for ip in host.ips|ipv4 %}
+{% if 'ipv4' in host %}
+{% for ip in host.ipv4 %}
{{ host.name }}.s. 600 IN A {{ ip }}
{% endfor %}
-{% for ip in host.ips|ipv6 %}
+{% endif %}
+{% if 'ipv6' in host %}
+{% for ip in host.ipv6 %}
{{ host.name }}.s. 600 IN AAAA {{ ip }}
{% endfor %}
{% endif %}
+{% endif %}
{% endfor %}