Add evaluate taget health for alias based records

pull/18777/head
Mike Buzzetti 9 years ago committed by Matt Clay
parent 76af56eaca
commit f20b09e2ec

@ -74,7 +74,12 @@ options:
required: false required: false
version_added: 1.9 version_added: 1.9
default: null default: null
aliases: [] alias_evaluate_target_health:
description:
- Whether or not to evaluate an alias target health. Useful for aliases to Elastic Load Balancers.
required: false
version_added: "2.0"
default: false
value: value:
description: description:
- The new value when creating a DNS record. Multiple comma-spaced values are allowed for non-alias records. When deleting a record all values for the record must be specified or Route53 will not delete it. - The new value when creating a DNS record. Multiple comma-spaced values are allowed for non-alias records. When deleting a record all values for the record must be specified or Route53 will not delete it.
@ -145,7 +150,9 @@ options:
required: false required: false
default: null default: null
version_added: "2.0" version_added: "2.0"
author: "Bruce Pennypacker (@bpennypacker)" author:
- "Bruce Pennypacker (@bpennypacker)"
- "Mike Buzzetti <mike.buzzetti@gmail.com>"
extends_documentation_fragment: aws extends_documentation_fragment: aws
''' '''
@ -208,7 +215,19 @@ EXAMPLES = '''
alias=True alias=True
alias_hosted_zone_id="{{ elb_zone_id }}" alias_hosted_zone_id="{{ elb_zone_id }}"
# Use a routing policy to distribute traffic: # Add an alias record that points to an Amazon ELB and evaluates it health:
- route53:
command=create
zone=foo.com
record=elb.foo.com
type=A
value="{{ elb_dns_name }}"
alias=True
alias_hosted_zone_id="{{ elb_zone_id }}"
alias_evaluate_target_health=True
# Add an AAAA record with Hosted Zone ID. Note that because there are colons in the value
# that the entire parameter list must be quoted:
- route53: - route53:
command: "create" command: "create"
zone: "foo.com" zone: "foo.com"
@ -289,13 +308,14 @@ def main():
zone = dict(required=True), zone = dict(required=True),
hosted_zone_id = dict(required=False, default=None), hosted_zone_id = dict(required=False, default=None),
record = dict(required=True), record = dict(required=True),
ttl = dict(required=False, default=3600), ttl = dict(required=False, type='int', default=3600),
type = dict(choices=['A', 'CNAME', 'MX', 'AAAA', 'TXT', 'PTR', 'SRV', 'SPF', 'NS'], required=True), type = dict(choices=['A', 'CNAME', 'MX', 'AAAA', 'TXT', 'PTR', 'SRV', 'SPF', 'NS'], required=True),
alias = dict(required=False, type='bool'), alias = dict(required=False, type='bool'),
alias_hosted_zone_id = dict(required=False), alias_hosted_zone_id = dict(required=False),
alias_evaluate_target_health = dict(required=False, type='bool', default=False),
value = dict(required=False), value = dict(required=False),
overwrite = dict(required=False, type='bool'), overwrite = dict(required=False, type='bool'),
retry_interval = dict(required=False, default=500) retry_interval = dict(required=False, default=500),
private_zone = dict(required=False, type='bool', default=False), private_zone = dict(required=False, type='bool', default=False),
identifier = dict(required=False, default=None), identifier = dict(required=False, default=None),
weight = dict(required=False, type='int'), weight = dict(required=False, type='int'),
@ -313,11 +333,13 @@ def main():
command_in = module.params.get('command') command_in = module.params.get('command')
zone_in = module.params.get('zone').lower() zone_in = module.params.get('zone').lower()
hosted_zone_id_in = module.params.get('hosted_zone_id') hosted_zone_id_in = module.params.get('hosted_zone_id')
ttl_in = int(module.params.get('ttl')) ttl_in = module.params.get('ttl')
record_in = module.params.get('record').lower() record_in = module.params.get('record').lower()
type_in = module.params.get('type') type_in = module.params.get('type')
value_in = module.params.get('value') value_in = module.params.get('value')
alias_in = module.params.get('alias')
alias_hosted_zone_id_in = module.params.get('alias_hosted_zone_id') alias_hosted_zone_id_in = module.params.get('alias_hosted_zone_id')
alias_evaluate_target_health_in = module.params.get('alias_evaluate_target_health')
retry_interval_in = module.params.get('retry_interval') retry_interval_in = module.params.get('retry_interval')
private_zone_in = module.params.get('private_zone') private_zone_in = module.params.get('private_zone')
identifier_in = module.params.get('identifier') identifier_in = module.params.get('identifier')
@ -394,7 +416,7 @@ def main():
health_check=health_check_in, failover=failover_in) health_check=health_check_in, failover=failover_in)
for v in value_list: for v in value_list:
if alias_in: if alias_in:
wanted_rset.set_alias(alias_hosted_zone_id_in, v) wanted_rset.set_alias(alias_hosted_zone_id_in, v, alias_evaluate_target_health_in)
else: else:
wanted_rset.add_value(v) wanted_rset.add_value(v)
@ -427,6 +449,7 @@ def main():
record['value'] = rset.alias_dns_name record['value'] = rset.alias_dns_name
record['values'] = [rset.alias_dns_name] record['values'] = [rset.alias_dns_name]
record['alias_hosted_zone_id'] = rset.alias_hosted_zone_id record['alias_hosted_zone_id'] = rset.alias_hosted_zone_id
record['alias_evaluate_target_health'] = rset.alias_evaluate_target_health
else: else:
record['alias'] = False record['alias'] = False
record['value'] = ','.join(sorted(rset.resource_records)) record['value'] = ','.join(sorted(rset.resource_records))

Loading…
Cancel
Save