From 6ce15dcd9616df34fe205b70362cfa22cdb5d3d7 Mon Sep 17 00:00:00 2001 From: Salt Date: Mon, 29 Jun 2020 11:15:36 -0500 Subject: [PATCH] Register DNS automatically for 9iron instances This opens the door to making new CNAME entries for other services automagically --- roles/dns/tasks/main.yml | 17 +++++++++++++++++ site.yml | 4 ++++ 2 files changed, 21 insertions(+) create mode 100644 roles/dns/tasks/main.yml diff --git a/roles/dns/tasks/main.yml b/roles/dns/tasks/main.yml new file mode 100644 index 0000000..7190d84 --- /dev/null +++ b/roles/dns/tasks/main.yml @@ -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 diff --git a/site.yml b/site.yml index 59b5184..20c58d7 100755 --- a/site.yml +++ b/site.yml @@ -21,6 +21,10 @@ 64303363653631653433343361616635373966326433663466636164613062343561333036613937 35616666633737356331653632323639373330396433366639326466373639313630 tags: [ common, user ] +- hosts: 9iron + roles: + - role: dns + tags: [ common, dns ] - import_playbook: playbooks/home.yml - import_playbook: playbooks/webservers.yml - import_playbook: playbooks/gameservers.yml