diff options
Diffstat (limited to 'roles/nameservers')
-rw-r--r-- | roles/nameservers/tasks/main.yml | 25 | ||||
-rw-r--r-- | roles/nameservers/templates/db.rainrainra.in.j2 | 16 | ||||
-rw-r--r-- | roles/nameservers/templates/db.rileyandlizzy.wedding.j2 | 16 | ||||
-rw-r--r-- | roles/nameservers/templates/db.simponic.xyz.j2 | 20 | ||||
-rw-r--r-- | roles/nameservers/templates/named.conf.local.primary.j2 | 7 | ||||
-rw-r--r-- | roles/nameservers/templates/named.conf.local.replica.j2 | 7 |
6 files changed, 91 insertions, 0 deletions
diff --git a/roles/nameservers/tasks/main.yml b/roles/nameservers/tasks/main.yml new file mode 100644 index 0000000..7f13ebd --- /dev/null +++ b/roles/nameservers/tasks/main.yml @@ -0,0 +1,25 @@ +--- +- name: create named.conf.local for primary + template: + src: ../templates/named.conf.local.primary.j2 + dest: /etc/bind/named.conf.local + when: inventory_hostname in groups['dnsprimary'] + +- name: create primary zone files for primary + template: + src: "../templates/{{ item.zone_file }}.j2" + dest: "/etc/bind/{{ item.zone_file }}" + with_items: "{{ dns_zones }}" + when: inventory_hostname in groups['dnsprimary'] + +- name: create named.conf.local for replica + template: + src: ../templates/named.conf.local.replica.j2 + dest: /etc/bind/named.conf.local + when: inventory_hostname in groups['dnsreplica'] + +- name: restart bind9 + service: + name: bind9 + state: restarted + enabled: true diff --git a/roles/nameservers/templates/db.rainrainra.in.j2 b/roles/nameservers/templates/db.rainrainra.in.j2 new file mode 100644 index 0000000..38a522e --- /dev/null +++ b/roles/nameservers/templates/db.rainrainra.in.j2 @@ -0,0 +1,16 @@ +$TTL 604800 +@ IN SOA {{ dns_primary_hostname }}.simponic.xyz. admin.simponic.xyz. ( + 5 ; Serial + 604800 ; Refresh + 86400 ; Retry + 2419200 ; Expire + 604800 ) ; Negative Cache TTL +; + +; Name servers +rainrainra.in. IN NS {{ dns_primary_hostname }}.simponic.xyz. +rainrainra.in. IN NS {{ dns_replica_hostname }}.simponic.xyz. + +; Other A records +@ IN A 129.123.76.14 +www IN A 129.123.76.14 diff --git a/roles/nameservers/templates/db.rileyandlizzy.wedding.j2 b/roles/nameservers/templates/db.rileyandlizzy.wedding.j2 new file mode 100644 index 0000000..e000923 --- /dev/null +++ b/roles/nameservers/templates/db.rileyandlizzy.wedding.j2 @@ -0,0 +1,16 @@ +$TTL 604800 +@ IN SOA {{ dns_primary_hostname }}.simponic.xyz. admin.simponic.xyz. ( + 5 ; Serial + 604800 ; Refresh + 86400 ; Retry + 2419200 ; Expire + 604800 ) ; Negative Cache TTL +; + +; Name servers +rileyandlizzy.wedding. IN NS {{ dns_primary_hostname }}.simponic.xyz. +rileyandlizzy.wedding. IN NS {{ dns_replica_hostname }}.simponic.xyz. + +; Other A records +@ IN A 129.123.76.14 +www IN A 129.123.76.14 diff --git a/roles/nameservers/templates/db.simponic.xyz.j2 b/roles/nameservers/templates/db.simponic.xyz.j2 new file mode 100644 index 0000000..ff38293 --- /dev/null +++ b/roles/nameservers/templates/db.simponic.xyz.j2 @@ -0,0 +1,20 @@ +$TTL 604800 +@ IN SOA {{ dns_primary_hostname }}.simponic.xyz. admin.simponic.xyz. ( + 5 ; Serial + 604800 ; Refresh + 86400 ; Retry + 2419200 ; Expire + 604800 ) ; Negative Cache TTL +; + +; Name servers +simponic.xyz. IN NS {{ dns_primary_hostname }}.simponic.xyz. +simponic.xyz. IN NS {{ dns_replica_hostname }}.simponic.xyz. + +; A records for name servers +{{ dns_primary_hostname }} IN A {{ dns_primary_ip }} +{{ dns_replica_hostname }} IN A {{ dns_replica_ip }} + +; Other A records +@ IN A 129.123.76.14 +www IN A 129.123.76.14 diff --git a/roles/nameservers/templates/named.conf.local.primary.j2 b/roles/nameservers/templates/named.conf.local.primary.j2 new file mode 100644 index 0000000..0234278 --- /dev/null +++ b/roles/nameservers/templates/named.conf.local.primary.j2 @@ -0,0 +1,7 @@ +{% for zone in dns_zones %} +zone "{{ zone.zone_name }}" { + type master; + file "/etc/bind/{{ zone.zone_file }}"; + allow-transfer { {{ dns_replica_ip }}; }; +}; +{% endfor %} diff --git a/roles/nameservers/templates/named.conf.local.replica.j2 b/roles/nameservers/templates/named.conf.local.replica.j2 new file mode 100644 index 0000000..bb14d7d --- /dev/null +++ b/roles/nameservers/templates/named.conf.local.replica.j2 @@ -0,0 +1,7 @@ +{% for zone in dns_zones %} +zone "{{ zone.zone_name }}" { + type slave; + file "db.{{ zone.zone_name }}"; + masters { {{ dns_primary_ip }}; }; +}; +{% endfor %} |