Add private_zone parameter for route53

Fixes #473
pull/18777/head
James Cammarata 10 years ago committed by Matt Clay
parent 411c7e22b6
commit 657d9d1f25

@ -98,6 +98,12 @@ options:
required: false required: false
default: 500 default: 500
aliases: [] aliases: []
private_zone:
description:
- If set to true, the private zone matching the requested name within the domain will be used if there are both public and private zones. The default is to use the public zone.
required: false
default: false
version_added: "1.9"
requirements: [ "boto" ] requirements: [ "boto" ]
author: Bruce Pennypacker author: Bruce Pennypacker
''' '''
@ -202,6 +208,7 @@ def main():
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),
) )
) )
module = AnsibleModule(argument_spec=argument_spec) module = AnsibleModule(argument_spec=argument_spec)
@ -214,6 +221,7 @@ def main():
value_in = module.params.get('value') value_in = module.params.get('value')
alias_hosted_zone_id_in = module.params.get('alias_hosted_zone_id') alias_hosted_zone_id_in = module.params.get('alias_hosted_zone_id')
retry_interval_in = module.params.get('retry_interval') retry_interval_in = module.params.get('retry_interval')
private_zone_in = module.params.get('private_zone')
ec2_url, aws_access_key, aws_secret_key, region = get_ec2_creds(module) ec2_url, aws_access_key, aws_secret_key, region = get_ec2_creds(module)
@ -250,6 +258,9 @@ def main():
zones = {} zones = {}
results = conn.get_all_hosted_zones() results = conn.get_all_hosted_zones()
for r53zone in results['ListHostedZonesResponse']['HostedZones']: for r53zone in results['ListHostedZonesResponse']['HostedZones']:
# only save this zone id if the private status of the zone matches
# the private_zone_in boolean specified in the params
if module.boolean(r53zone['Config']['PrivateZone']) == private_zone_in:
zone_id = r53zone['Id'].replace('/hostedzone/', '') zone_id = r53zone['Id'].replace('/hostedzone/', '')
zones[r53zone['Name']] = zone_id zones[r53zone['Name']] = zone_id

Loading…
Cancel
Save