From 91e9223a763bf5aa6515f02e377b38c7b5be2072 Mon Sep 17 00:00:00 2001 From: mansunkuo Date: Mon, 6 Jun 2016 15:51:25 -0500 Subject: [PATCH] Add an example to delete Route53 alias record set (#3834) --- cloud/amazon/route53.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/cloud/amazon/route53.py b/cloud/amazon/route53.py index 5141a0d7dab..107ca757d95 100644 --- a/cloud/amazon/route53.py +++ b/cloud/amazon/route53.py @@ -95,7 +95,7 @@ options: description: - Have to be specified for Weighted, latency-based and failover resource record sets only. An identifier that differentiates among multiple resource record sets that have the - same combination of DNS name and type. + same combination of DNS name and type. required: false default: null version_added: "2.0" @@ -194,7 +194,7 @@ EXAMPLES = ''' type: "AAAA" ttl: "7200" value: "::1" - + # Add a SRV record with multiple fields for a service on port 22222 # For more information on SRV records see: # https://en.wikipedia.org/wiki/SRV_record @@ -225,6 +225,25 @@ EXAMPLES = ''' alias=True alias_hosted_zone_id="{{ elb_zone_id }}" +# Retrieve the details for elb.foo.com +- route53: + command: get + zone: foo.com + record: elb.foo.com + type: A + register: rec + +# Delete an alias record using the results from the get command +- route53: + command: delete + zone: foo.com + record: "{{ rec.set.record }}" + ttl: "{{ rec.set.ttl }}" + type: "{{ rec.set.type }}" + value: "{{ rec.set.value }}" + alias: True + alias_hosted_zone_id: "{{ rec.set.alias_hosted_zone_id }}" + # Add an alias record that points to an Amazon ELB and evaluates it health: - route53: command=create @@ -556,7 +575,7 @@ def main(): txt = txt.split("")[0] if "but it already exists" in txt: module.exit_json(changed=False) - else: + else: module.fail_json(msg = txt) except TimeoutError: module.fail_json(msg='Timeout waiting for changes to replicate')