Skip to content

Instantly share code, notes, and snippets.

@famousgarkin
Created May 4, 2017 08:19
Show Gist options
  • Save famousgarkin/4da1a34c1f8402f5f0000586b2fc40a9 to your computer and use it in GitHub Desktop.
Save famousgarkin/4da1a34c1f8402f5f0000586b2fc40a9 to your computer and use it in GitHub Desktop.
Ansible AWS Route 53 export playbook
- hosts: localhost
gather_facts: no
tasks:
- name: get hosted zones
route53_facts: query=hosted_zone
register: hosted_zone
- name: get record sets
route53_facts: query=record_sets hosted_zone_id={{item.Id}}
with_items: '{{hosted_zone.HostedZones}}'
register: record_sets
- name: save record sets
copy: content={{item.1|to_nice_json}} dest=files/dns/aws-route53-{{item.0.Name}}json
with_together:
- '{{hosted_zone.HostedZones}}'
- '{{record_sets.results}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment