working dns

This commit is contained in:
Elizabeth Hunt 2024-01-02 02:10:54 -05:00
parent c0ed0a948f
commit 1f9f2b7608
5 changed files with 48 additions and 7 deletions

View File

@ -15,6 +15,9 @@ dns_zones:
- zone_name: rileyandlizzy.wedding - zone_name: rileyandlizzy.wedding
zone_file: db.rileyandlizzy.wedding zone_file: db.rileyandlizzy.wedding
dns_sec_zones:
- zone: simponic.xyz
dns_primary_hostname: ryo dns_primary_hostname: ryo
dns_replica_hostname: nijika dns_replica_hostname: nijika
dns_primary_ip: 107.173.19.33 dns_primary_ip: 107.173.19.33

View File

@ -1,6 +1,8 @@
--- ---
- name: install BIND - name: install BIND
apt: name=bind9 state=latest apt: name=bind9 state=latest
- name: install BIND-utils
apt: name=bind9-utils state=latest
- name: copy named.conf.options - name: copy named.conf.options
copy: copy:

View File

@ -1,21 +1,40 @@
--- ---
## PRIMARY
- name: create named.conf.local for primary - name: create named.conf.local for primary
template: template:
src: ../templates/named.conf.local.primary.j2 src: ../templates/named.conf.local.primary.j2
dest: /etc/bind/named.conf.local dest: /etc/bind/named.conf.local
owner: bind
group: bind
when: inventory_hostname in groups['dnsprimary'] when: inventory_hostname in groups['dnsprimary']
- name: create /etc/bind/zones if not exist
ansible.builtin.file:
path: /etc/bind/zones
state: directory
owner: bind
group: bind
- name: create primary zone files for primary - name: create primary zone files for primary
template: template:
src: "../templates/{{ item.zone_file }}.j2" src: "../templates/{{ item.zone_file }}.j2"
dest: "/etc/bind/{{ item.zone_file }}" dest: "/etc/bind/zones/{{ item.zone_file }}"
owner: bind
group: bind
with_items: "{{ dns_zones }}" with_items: "{{ dns_zones }}"
when: inventory_hostname in groups['dnsprimary'] when: inventory_hostname in groups['dnsprimary']
## REPLICA
- name: create named.conf.local for replica - name: create named.conf.local for replica
template: template:
src: ../templates/named.conf.local.replica.j2 src: ../templates/named.conf.local.replica.j2
dest: /etc/bind/named.conf.local dest: /etc/bind/named.conf.local
owner: bind
group: bind
when: inventory_hostname in groups['dnsreplica'] when: inventory_hostname in groups['dnsreplica']
- name: restart bind9 - name: restart bind9

View File

@ -1,7 +1,7 @@
$TTL 604800 $TTL 604800
@ IN SOA {{ dns_primary_hostname }}.simponic.xyz. admin.simponic.xyz. ( @ IN SOA {{ dns_primary_hostname }}.simponic.xyz. admin.simponic.xyz. (
5 ; Serial 1704161086 ; Serial
604800 ; Refresh 86400 ; Refresh
86400 ; Retry 86400 ; Retry
2419200 ; Expire 2419200 ; Expire
604800 ) ; Negative Cache TTL 604800 ) ; Negative Cache TTL
@ -15,6 +15,23 @@ simponic.xyz. IN NS {{ dns_replica_hostname }}.simponic.xyz.
{{ dns_primary_hostname }} IN A {{ dns_primary_ip }} {{ dns_primary_hostname }} IN A {{ dns_primary_ip }}
{{ dns_replica_hostname }} IN A {{ dns_replica_ip }} {{ dns_replica_hostname }} IN A {{ dns_replica_ip }}
; Other A records ;; A Records
@ IN A 129.123.76.14 mail.simponic.xyz. 1 IN A 192.3.248.205
www IN A 129.123.76.14 simponic.xyz. 1 IN A 129.123.76.14
;; CNAME Records
s1._domainkey.simponic.xyz. 1 IN CNAME s1.domainkey.u25709709.wl210.sendgrid.net.
s2._domainkey.simponic.xyz. 1 IN CNAME s2.domainkey.u25709709.wl210.sendgrid.net.
static.simponic.xyz. 1 IN CNAME simponic.xyz.
www.simponic.xyz. 1 IN CNAME simponic.xyz.
;; MX Records
simponic.xyz. 1 IN MX 10 mail.simponic.xyz.
;; TXT Records
_acme-challenge.simponic.xyz. 1 IN TXT "6GcrSuBAj8pNKqiCBWUIONRJjbDVtOizadBDGngW4-U"
_acme-challenge.simponic.xyz. 1 IN TXT "IErMxNBY3v1Wc3RV06khZXKDC1f9EObYHSXETK5ZKYE"
_acme-challenge.simponic.xyz. 1 IN TXT "3jWQSVbU-SdebeymX58bir5kEHG1dVHRXYE-P_4Qao8"
_acme-challenge.simponic.xyz. 1 IN TXT "LXaVBwQCanWKF4cNxzPHHPM9N-kkjhn8_4r6RsveBqs"
dkim._domainkey.simponic.xyz. 1 IN TXT "v=DKIM1; p= MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoNWLcbrcGq0z8f0fSmxLbfK/Q/ZwmnPyJEfljS2VuDIm7DUXahHIFtB8hfZ/WAocoirb8kUHTvTAgmUOXPpNxTDve3tV9S+CBBYHH2c9XBsuaZn/Vi0TR5vbBDuISmlXT6k+2cdq0LO+PYRwJI65t/JWTR5fQlCmVgxbI5gwDYFRZC0Nl5gEwuKw7pdEJg4Pymyox" "i" "zcikaGk/plXj6BDvv9pK1q8Wa+QPIkuBPFvsEh3KSApMP1p5thzHFaeNyCn5PuYEvbgkal0722px6GvYfR2W/APNRztbmWVewXH6kEWCgOYMkmWiYYLgEwz62rq2SzszP1rrl3WjVi26916wIDAQAB"
simponic.xyz. 1 IN TXT "v=spf1 mx ip4:192.3.248.205 ~all"

View File

@ -1,7 +1,7 @@
{% for zone in dns_zones %} {% for zone in dns_zones %}
zone "{{ zone.zone_name }}" { zone "{{ zone.zone_name }}" {
type master; type master;
file "/etc/bind/{{ zone.zone_file }}"; file "/etc/bind/zones/{{ zone.zone_file }}";
allow-transfer { {{ dns_replica_ip }}; }; allow-transfer { {{ dns_replica_ip }}; };
}; };
{% endfor %} {% endfor %}