Created
June 3, 2019 14:58
-
-
Save john-auld/75ed8f9209dbbcaf0dee867b58fa19ba to your computer and use it in GitHub Desktop.
Ansible playbook to dump a DNS Zone hosted by Digital Ocean to a BIND style zone file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# | |
# Dump DNS Zone file from a zone hosted by Digital Ocean | |
# | |
- hosts: localhost | |
connection: local | |
gather_facts: false | |
vars: | |
oauth_token: "redacted-api-key-from-digital-ocean" | |
zone: "example.com" | |
tasks: | |
- name: Gather facts about domain with given name | |
digital_ocean_domain_facts: | |
oauth_token: "{{ oauth_token }}" | |
domain_name: "{{ zone }}" | |
register: resp_out | |
- name: debug stdout | |
set_fact: | |
zone_data: "{{ resp_out }}" | |
- name: Output zone file | |
local_action: copy content={{ zone_data.data[0].zone_file }} dest="{{ zone }}.zone.txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment