From d1b0579a41c8215487a17317851f01756a1d938d Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 29 Dec 2020 13:08:13 +0100 Subject: Add dns, dyndns services --- dns.yml | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 dns.yml (limited to 'dns.yml') diff --git a/dns.yml b/dns.yml new file mode 100644 index 0000000..0fd753a --- /dev/null +++ b/dns.yml @@ -0,0 +1,91 @@ +- name: Setup subdomain A records pointing to wendelstein + inwx: + domain: "{{item.partition('.')[2]}}" + record: "{{item.partition('.')[0]}}" + type: A + value: "{{ hostvars['wendelstein']['ansible_default_ipv4']['address'] }}" + loop: "{{subdomains}}" + +- name: Setup dyndns A record + inwx: + domain: jaseg.de + record: ns + type: A + value: "{{ hostvars['wendelstein']['ansible_default_ipv4']['address'] }}" + +- name: Setup dyndns NS record + inwx: + domain: jaseg.de + record: dyn + type: NS + value: 'ns.jaseg.de' + +- name: Setup subdomain AAAA records pointing to wendelstein + inwx: + domain: "{{item.partition('.')[2]}}" + record: "{{item.partition('.')[0]}}" + type: AAAA + value: "{{ hostvars['wendelstein']['ansible_default_ipv6']['address'] }}" + loop: "{{subdomains}}" + +- name: Setup jaseg.net subdomain MX records pointing to fastmail + inwx: + domain: "{{item.partition('.')[2]}}" + record: "{{item.partition('.')[0]}}" + type: MX + priority: 10 + value: in1-smtp.messagingengine.com + loop: "{{subdomains}}" + +- name: Setup jaseg.net subdomain MX records pointing to fastmail + inwx: + domain: "{{item.partition('.')[2]}}" + record: "{{item.partition('.')[0]}}" + type: MX + priority: 20 + value: in2-smtp.messagingengine.com + loop: "{{subdomains}}" + +- name: Setup sendgrid gateway + inwx: + domain: jaseg.de + type: CNAME + record: "{{item.split(' ')[0]}}" + value: "{{item.split(' ')[1]}}" + loop: + - em6100.automation u14518136.wl137.sendgrid.net + - s1._domainkey.automation s1.domainkey.u14518136.wl137.sendgrid.net + - s2._domainkey.automation s2.domainkey.u14518136.wl137.sendgrid.net + +- name: Set fastmail DNS entry template + set_fact: + fastmail_dns_entries: + - {rtype: MX, record: ".", prio: 10, value: in1-smtp.messagingengine.com} + - {rtype: MX, record: ".", prio: 20, value: in2-smtp.messagingengine.com} + - {rtype: MX, record: "*", prio: 10, value: in1-smtp.messagingengine.com} + - {rtype: MX, record: "*", prio: 20, value: in2-smtp.messagingengine.com} + - {rtype: TXT, record: ".", value: "v=spf1 include:spf.messagingengine.com ?all"} + - {rtype: CNAME, record: mesmtp._domainkey, value: mesmtp.jaseg.de.dkim.fmhosted.com} + - {rtype: CNAME, record: fm1._domainkey, value: fm1.jaseg.de.dkim.fmhosted.com} + - {rtype: CNAME, record: fm2._domainkey, value: fm2.jaseg.de.dkim.fmhosted.com} + - {rtype: CNAME, record: fm3._domainkey, value: fm3.jaseg.de.dkim.fmhosted.com} + - {rtype: SRV, record: _submission._tcp, prio: 0, weight: 1, port: 587, value: smtp.fastmail.com} + - {rtype: SRV, record: _imap._tcp, prio: 0, weight: 0, port: 0, value: "."} + - {rtype: SRV, record: _imaps._tcp, prio: 0, weight: 1, port: 993, value: imap.fastmail.com} + - {rtype: SRV, record: _pop3._tcp, prio: 0, weight: 0, port: 0, value: "."} + - {rtype: SRV, record: _pop3s._tcp, prio: 10, weight: 1, port: 995, value: pop.fastmail.com} + - {rtype: SRV, record: _jmap._tcp, prio: 0, weight: 1, port: 443, value: jmap.fastmail.com} + - {rtype: SRV, record: _carddav._tcp, prio: 0, weight: 0, port: 0, value: "."} + - {rtype: SRV, record: _carddavs._tcp, prio: 0, weight: 1, port: 443, value: carddav.fastmail.com} + +- name: Setup fastmail DNS entries + inwx: + domain: "{{ item[1] }}" + type: "{{ item[0]['rtype'] }}" + record: "{{ item[0]['record'] | regex_replace('\\.*$', '') }}" + priority: "{{ item[0].get('prio') | int }}" + port: "{{ item[0].get('port') | int}}" + weight: "{{ item[0].get('weight') | int }}" + value: "{{ item[0]['value'] }}" + loop: "{{ fastmail_dns_entries | product(fastmail_domains) | list }}" + -- cgit