Register DNS automatically for 9iron instances

This opens the door to making new CNAME entries for other services
automagically
This commit is contained in:
Salt 2020-06-29 11:15:36 -05:00
parent 997fc8b3ee
commit 6ce15dcd96
2 changed files with 21 additions and 0 deletions

17
roles/dns/tasks/main.yml Normal file
View File

@ -0,0 +1,17 @@
#!/usr/bin/ansible-playbook
# vim:ft=ansible:
---
- name: Add machine to DNS zone
block:
- name: Get public IP
ipify_facts:
- name: Register record in zone
route53:
state: present
zone: 9iron.club
type: A
record: "{{ inventory_hostname }}.9iron.club."
ttl: 300
value:
- "{{ ipify_public_ip }}"
wait: yes

View File

@ -21,6 +21,10 @@
64303363653631653433343361616635373966326433663466636164613062343561333036613937 64303363653631653433343361616635373966326433663466636164613062343561333036613937
35616666633737356331653632323639373330396433366639326466373639313630 35616666633737356331653632323639373330396433366639326466373639313630
tags: [ common, user ] tags: [ common, user ]
- hosts: 9iron
roles:
- role: dns
tags: [ common, dns ]
- import_playbook: playbooks/home.yml - import_playbook: playbooks/home.yml
- import_playbook: playbooks/webservers.yml - import_playbook: playbooks/webservers.yml
- import_playbook: playbooks/gameservers.yml - import_playbook: playbooks/gameservers.yml