From 46cfbbc64f1aa1af1892401436c6d85f7d8ca810 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 21 Sep 2019 17:48:52 +0800 Subject: zones/233233.xyz: Do not hardcode subdomains --- roles/dns/templates/zones/233233.xyz.zone.j2 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/dns/templates/zones/233233.xyz.zone.j2 b/roles/dns/templates/zones/233233.xyz.zone.j2 index efe0716..9f41554 100644 --- a/roles/dns/templates/zones/233233.xyz.zone.j2 +++ b/roles/dns/templates/zones/233233.xyz.zone.j2 @@ -21,8 +21,18 @@ $TTL {{ dns.ttl }} @ IN A {{ network.ipv4.address }} @ IN AAAA {{ network.ipv6.address }} -{% for name in ["www", "d", "g", "zw", "*"] %} +{% set subdomains = [] %} +{% for name in domains -%} + {%- if name["name"] == domain -%} + {%- for sub in name["sub"] -%} + {{ subdomains.append(sub) }} + {%- endfor -%} + {%- endif -%} +{%- endfor %} +{% for name in subdomains %} {{ name }} IN CNAME @ {% endfor %} +* IN CNAME @ + ; vim: set ft=bindzone: -- cgit v1.2.2