Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 1 | ;## NSD authoritative only DNS |
| 2 | ;## FORWARD Zone |
| 3 | |
| 4 | $ORIGIN {{ item.name }}. ; default zone domain |
| 5 | $TTL {{ item.ttl | default(dns_ttl) }} ; default time to live |
| 6 | |
| 7 | @ IN SOA {{ item.soa }}.{{ item.name }}. admin.{{ item.name }}. ( |
| 8 | {{ item.serial | default(ansible_date_time.epoch) }} ; Serial, must be incremented every time you change this file |
| 9 | 3600 ; Refresh [1hr] |
| 10 | 600 ; Retry [10m] |
| 11 | 3600 ; Expire [1hr] |
| 12 | 60 ; Min TTL [1m] |
| 13 | ) |
Zack Williams | 961d369 | 2016-05-01 09:24:30 -0700 | [diff] [blame] | 14 | |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 15 | ; Name Servers |
| 16 | {% for ns in item.ns %} |
| 17 | IN NS {{ ns.name ~ '.' ~ item.name }}. |
| 18 | {% endfor %} |
| 19 | |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 20 | ;A and CNAME records |
Zack Williams | 961d369 | 2016-05-01 09:24:30 -0700 | [diff] [blame] | 21 | {% if name_on_public_interface is defined %} |
| 22 | {{ name_on_public_interface }} IN A {{ ansible_default_ipv4.address }} |
| 23 | {% endif %} |
| 24 | {% if item.aliases is defined %} |
| 25 | {% for alias in item.aliases %} |
| 26 | {{ alias.name }} IN CNAME {{ alias.dest }} |
| 27 | {% endfor %} |
| 28 | {% endif %} |
| 29 | |
| 30 | ; Set from list of nodes |
| 31 | {% set nodes = vars[item.nodelist] %} |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 32 | {% for node in nodes %} |
| 33 | {{ node.name }} IN A {{ item.ipv4_first_octets ~ "." ~ node.ipv4_last_octet }} |
| 34 | {% if node.aliases is defined %} |
| 35 | {% for alias in node.aliases %} |
| 36 | {{ alias }} IN CNAME {{ node.name }} |
| 37 | {% endfor %} |
| 38 | {% endif %} |
| 39 | {% endfor %} |
| 40 | |