Updated dns playbook to support multiple domains and added forms record

This commit is contained in:
Phil 2024-11-11 11:04:52 -07:00
parent 7ec81f80c3
commit e64bef6ac8

56
dns.yml
View File

@ -1,36 +1,44 @@
--- ---
# dns.yml # dns.yml
- name: Add A Records for thesatelliteoflove.com - name: Add A Records for thesatelliteoflove.com and nerder.land
hosts: localhost hosts: localhost
gather_facts: false gather_facts: false
vars: vars:
domain_name: thesatelliteoflove.com # Domains to manage DNS records for
dns_records: domains:
- name: "pin" - name: thesatelliteoflove.com
ip: "152.53.36.98" dns_records:
- name: "home" - name: "pin"
ip: "152.53.36.98" ip: "152.53.36.98"
- name: "git" - name: "home"
ip: "152.53.36.98" ip: "152.53.36.98"
- name: "social" - name: "git"
ip: "152.53.36.98" ip: "152.53.36.98"
- name: "auth" - name: "social"
ip: "152.53.36.98" ip: "152.53.36.98"
- name: "audio" - name: "auth"
ip: "152.53.36.98" ip: "152.53.36.98"
- name: "books" - name: "audio"
ip: "152.53.36.98" ip: "152.53.36.98"
- name: "paper" - name: "books"
ip: "152.53.36.98" ip: "152.53.36.98"
- name: "paper"
ip: "152.53.36.98"
- name: nerder.land
dns_records:
- name: "forms"
ip: "152.53.36.98"
tasks: tasks:
- name: Add A records for subdomains - name: Add A records for subdomains of each domain
amazon.aws.route53: amazon.aws.route53:
state: present state: present
zone: "{{ domain_name }}" zone: "{{ item.0.name }}"
record: "{{ item.name }}.{{ domain_name }}" record: "{{ item.1.name }}.{{ item.0.name }}"
type: A type: A
ttl: 300 ttl: 300
value: "{{ item.ip }}" value: "{{ item.1.ip }}"
loop: "{{ dns_records }}" loop: "{{ query('subelements', domains, 'dns_records') }}"
loop_control:
loop_var: item