Skip to content

Instantly share code, notes, and snippets.

@texdc
Created October 6, 2017 21:06
Show Gist options
  • Save texdc/9c94d5bd7cf4938bc1c680846f67e8a3 to your computer and use it in GitHub Desktop.
Save texdc/9c94d5bd7cf4938bc1c680846f67e8a3 to your computer and use it in GitHub Desktop.
Two ansible commands to get the Route53 zone id for a given DNS zone
---
- name: get hosted zone info
route53_facts:
query: hosted_zone
register: zone_info
- name: get zone id
set_fact:
zone_id: "{{ zone.Id | regex_replace('/hostedzone/', '') }}"
when: zone.Name == route53_zone + '.'
with_items: "{{ zone_info.HostedZones }}"
loop_control:
loop_var: zone
@pauby
Copy link

pauby commented Dec 15, 2020

route53_facts has been deprecated and route53_info is now what should be used instead.

But thank you for this. Saved me a lot of time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment