diff options
author | Aaron LI <aly@aaronly.me> | 2019-09-21 17:48:52 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2019-09-21 17:48:52 +0800 |
commit | 46cfbbc64f1aa1af1892401436c6d85f7d8ca810 (patch) | |
tree | 118936102534426ef15d318d3f48d979aa09c917 /roles/dns/templates/zones/233233.xyz.zone.j2 | |
parent | 83d991daa85a00ade2ee455aeef2c21e9aceb07d (diff) | |
download | ansible-dfly-vps-46cfbbc64f1aa1af1892401436c6d85f7d8ca810.tar.bz2 |
zones/233233.xyz: Do not hardcode subdomains
Diffstat (limited to 'roles/dns/templates/zones/233233.xyz.zone.j2')
-rw-r--r-- | roles/dns/templates/zones/233233.xyz.zone.j2 | 12 |
1 files changed, 11 insertions, 1 deletions
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: |