2022-02-23 17:30:10 -06:00
|
|
|
#!/usr/bin/env ansible-playbook
|
|
|
|
# vim:ft=ansible:
|
|
|
|
---
|
|
|
|
- hosts: all
|
2022-04-11 12:27:53 -05:00
|
|
|
gather_facts: no
|
2022-08-28 11:41:38 -05:00
|
|
|
become: no
|
2023-10-29 14:13:30 -05:00
|
|
|
serial: 1
|
2022-02-23 17:30:10 -06:00
|
|
|
module_defaults:
|
2023-10-29 14:04:46 -05:00
|
|
|
amazon.aws.route53:
|
2022-02-23 17:30:10 -06:00
|
|
|
# These credentials are specific to this playbook
|
|
|
|
aws_access_key: !vault |
|
|
|
|
$ANSIBLE_VAULT;1.1;AES256
|
|
|
|
32333663353432653161386337326538346563393832643238313438326138326462336535616232
|
|
|
|
3534313938383965666537363839346138633232326138300a326366393861343038633162663435
|
|
|
|
36313937663136313532613533653966623436313939343864383534616233343961313337626630
|
|
|
|
3232633035303634390a653230643934616534343033393138343861356364623037616661623363
|
|
|
|
65363165656461366236366632356363616264666439333133643162626535346561
|
|
|
|
aws_secret_key: !vault |
|
|
|
|
$ANSIBLE_VAULT;1.1;AES256
|
|
|
|
31333563386431636333343363623235353537356262626635613636663561343262383338306164
|
|
|
|
3435376366326330663563366631353138616163623766660a383533663333646431373733356564
|
|
|
|
31333966303062636136343163363136383465303362333435383830323739333736343164663235
|
|
|
|
6134393337636461610a346463386566653563353466386333623866303661646564356166363033
|
|
|
|
35326337636464376566393764663261346339633035613732633134656233393130646161326361
|
|
|
|
6231653638613061373734373539313933343739346537373961
|
|
|
|
zone: desu.ltd
|
2022-03-07 10:46:02 -06:00
|
|
|
overwrite: yes
|
2022-02-23 17:30:10 -06:00
|
|
|
tasks:
|
2022-05-15 15:40:11 -05:00
|
|
|
- name: clear host errors before dns loop
|
2022-06-16 23:45:29 -05:00
|
|
|
ansible.builtin.meta: clear_host_errors
|
2022-02-23 17:30:10 -06:00
|
|
|
- name: configure dns
|
|
|
|
block:
|
|
|
|
- name: configure main mgmt dns
|
2023-10-29 14:04:46 -05:00
|
|
|
amazon.aws.route53:
|
2022-02-23 17:30:10 -06:00
|
|
|
record: "{{ inventory_hostname }}"
|
|
|
|
type: A
|
|
|
|
ttl: 3600
|
|
|
|
state: present
|
|
|
|
value:
|
|
|
|
- "{{ ansible_host }}"
|
|
|
|
tags: [ route53, dns, main ]
|
|
|
|
- name: configure interface dns
|
2023-10-29 14:04:46 -05:00
|
|
|
amazon.aws.route53:
|
2022-02-23 17:30:10 -06:00
|
|
|
record: "{{ item.name }}.{{ inventory_hostname }}"
|
|
|
|
type: A
|
|
|
|
ttl: 3600
|
|
|
|
state: present
|
|
|
|
value:
|
|
|
|
- "{{ item.ip_addresses[0].address | regex_replace('/.*', '') }}"
|
|
|
|
with_items: "{{ interfaces }}"
|
2022-05-10 05:52:11 -05:00
|
|
|
when: item.ip_addresses[0].address is defined
|
2022-02-23 17:30:10 -06:00
|
|
|
loop_control:
|
|
|
|
label: "{{ item.display }}"
|
|
|
|
tags: [ route53, dns, interface ]
|
2022-04-18 11:08:07 -05:00
|
|
|
- name: configure root a record
|
|
|
|
run_once: yes
|
2023-10-29 14:04:46 -05:00
|
|
|
amazon.aws.route53:
|
2022-04-18 11:08:07 -05:00
|
|
|
record: desu.ltd
|
|
|
|
type: A
|
|
|
|
ttl: 3600
|
|
|
|
state: present
|
2022-08-30 16:15:17 -05:00
|
|
|
value: 5.161.106.16
|
2022-04-18 11:08:07 -05:00
|
|
|
tags: [ route53, dns ]
|
2022-02-23 17:30:10 -06:00
|
|
|
delegate_to: localhost
|
|
|
|
when: status.value == "active" and inventory_hostname is match(".*\.desu\.ltd")
|
|
|
|
tags: [ route53, dns ]
|
|
|
|
- name: configure legacy dns
|
2023-10-29 14:04:46 -05:00
|
|
|
amazon.aws.route53:
|
2022-02-23 17:30:10 -06:00
|
|
|
record: "{{ item.record }}"
|
|
|
|
type: "{{ item.type | default('CNAME', true) }}"
|
|
|
|
ttl: 3600
|
|
|
|
state: "{{ item.state | default('present', true) }}"
|
|
|
|
value: [ "{{ item.value }}" ]
|
|
|
|
with_items:
|
|
|
|
- record: dsk-ryzen-0.desu.ltd
|
|
|
|
value: dsk-ryzen-1.ws.mgmt.desu.ltd
|
|
|
|
- record: lap-s76-lemp9-0.desu.ltd
|
|
|
|
value: lap-s76-lemp9-1.ws.mgmt.desu.ltd
|
|
|
|
- record: pi-homeauto-1.desu.ltd
|
|
|
|
value: pi-homeauto-1.home.mgmt.desu.ltd
|
|
|
|
loop_control:
|
|
|
|
label: "{{ item.record }}"
|
|
|
|
delegate_to: localhost
|
|
|
|
run_once: true
|
|
|
|
tags: [ route53, dns, legacy ]
|
|
|
|
- name: configure site dns
|
2023-10-29 14:04:46 -05:00
|
|
|
amazon.aws.route53:
|
2022-02-23 17:30:10 -06:00
|
|
|
record: "{{ item.record }}"
|
|
|
|
type: "{{ item.type | default('CNAME', true) }}"
|
|
|
|
ttl: 3600
|
|
|
|
state: "{{ item.state | default('present', true) }}"
|
|
|
|
value: [ "{{ item.value }}" ]
|
|
|
|
with_items:
|
|
|
|
# Public
|
2022-09-03 17:27:17 -05:00
|
|
|
- record: firefly.desu.ltd
|
|
|
|
value: vm-general-1.ashburn.mgmt.desu.ltd
|
2022-09-03 18:19:51 -05:00
|
|
|
- record: firefly-importer.desu.ltd
|
|
|
|
value: vm-general-1.ashburn.mgmt.desu.ltd
|
2022-02-23 17:30:10 -06:00
|
|
|
- record: git.desu.ltd
|
2022-08-04 18:09:26 -05:00
|
|
|
value: vm-general-1.ashburn.mgmt.desu.ltd
|
2022-02-23 17:30:10 -06:00
|
|
|
- record: matrix.desu.ltd
|
2022-07-21 21:05:27 -05:00
|
|
|
value: vm-general-1.ashburn.mgmt.desu.ltd
|
2022-02-23 17:30:10 -06:00
|
|
|
- record: movie.desu.ltd
|
2022-07-21 21:05:27 -05:00
|
|
|
value: vm-general-1.ashburn.mgmt.desu.ltd
|
2022-02-23 17:30:10 -06:00
|
|
|
- record: nagios.desu.ltd
|
2022-07-21 21:05:27 -05:00
|
|
|
value: vm-general-1.ashburn.mgmt.desu.ltd
|
2022-02-23 17:30:10 -06:00
|
|
|
- record: nc.desu.ltd
|
2022-07-21 21:05:27 -05:00
|
|
|
value: vm-general-1.ashburn.mgmt.desu.ltd
|
2022-02-23 17:30:10 -06:00
|
|
|
- record: netbox.desu.ltd
|
2022-07-21 21:05:27 -05:00
|
|
|
value: vm-general-1.ashburn.mgmt.desu.ltd
|
2022-11-13 20:55:40 -06:00
|
|
|
# Public media stuff
|
|
|
|
- record: prowlarr.media.desu.ltd
|
|
|
|
value: vm-general-1.ashburn.mgmt.desu.ltd
|
|
|
|
- record: sonarr.media.desu.ltd
|
|
|
|
value: vm-general-1.ashburn.mgmt.desu.ltd
|
|
|
|
- record: radarr.media.desu.ltd
|
|
|
|
value: vm-general-1.ashburn.mgmt.desu.ltd
|
|
|
|
- record: transmission.media.desu.ltd
|
|
|
|
value: vm-general-1.ashburn.mgmt.desu.ltd
|
2022-02-23 17:30:10 -06:00
|
|
|
loop_control:
|
|
|
|
label: "{{ item.record }}"
|
|
|
|
delegate_to: localhost
|
|
|
|
run_once: true
|
|
|
|
tags: [ route53, dns, site ]
|