mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
* improve ec2_vpc_route_table documentation * make pep8
This commit is contained in:
parent
3aef028d42
commit
5e67f86586
1 changed files with 16 additions and 15 deletions
|
@ -31,7 +31,8 @@ options:
|
||||||
description:
|
description:
|
||||||
- "Look up route table by either tags or by route table ID. Non-unique tag lookup will fail.
|
- "Look up route table by either tags or by route table ID. Non-unique tag lookup will fail.
|
||||||
If no tags are specifed then no lookup for an existing route table is performed and a new
|
If no tags are specifed then no lookup for an existing route table is performed and a new
|
||||||
route table will be created. To change tags of a route table, you must look up by id."
|
route table will be created. To change tags of a route table or delete a route table,
|
||||||
|
you must look up by id."
|
||||||
required: false
|
required: false
|
||||||
default: tag
|
default: tag
|
||||||
choices: [ 'tag', 'id' ]
|
choices: [ 'tag', 'id' ]
|
||||||
|
@ -295,7 +296,7 @@ def get_route_table_by_tags(vpc_conn, vpc_id, tags):
|
||||||
this_tags = get_resource_tags(vpc_conn, table.id)
|
this_tags = get_resource_tags(vpc_conn, table.id)
|
||||||
if tags_match(tags, this_tags):
|
if tags_match(tags, this_tags):
|
||||||
route_table = table
|
route_table = table
|
||||||
count +=1
|
count += 1
|
||||||
|
|
||||||
if count > 1:
|
if count > 1:
|
||||||
raise RuntimeError("Tags provided do not identify a unique route table")
|
raise RuntimeError("Tags provided do not identify a unique route table")
|
||||||
|
@ -427,7 +428,7 @@ def ensure_subnet_associations(vpc_conn, vpc_id, route_table, subnets,
|
||||||
|
|
||||||
if purge_subnets:
|
if purge_subnets:
|
||||||
to_delete = [a_id for a_id in current_association_ids
|
to_delete = [a_id for a_id in current_association_ids
|
||||||
if a_id not in new_association_ids]
|
if a_id not in new_association_ids]
|
||||||
|
|
||||||
for a_id in to_delete:
|
for a_id in to_delete:
|
||||||
changed = True
|
changed = True
|
||||||
|
@ -504,10 +505,10 @@ def get_route_table_info(route_table):
|
||||||
for route in route_table.routes:
|
for route in route_table.routes:
|
||||||
routes.append(route.__dict__)
|
routes.append(route.__dict__)
|
||||||
|
|
||||||
route_table_info = { 'id': route_table.id,
|
route_table_info = {'id': route_table.id,
|
||||||
'routes': routes,
|
'routes': routes,
|
||||||
'tags': route_table.tags,
|
'tags': route_table.tags,
|
||||||
'vpc_id': route_table.vpc_id }
|
'vpc_id': route_table.vpc_id}
|
||||||
|
|
||||||
return route_table_info
|
return route_table_info
|
||||||
|
|
||||||
|
@ -619,16 +620,16 @@ def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(
|
argument_spec.update(
|
||||||
dict(
|
dict(
|
||||||
lookup = dict(default='tag', required=False, choices=['tag', 'id']),
|
lookup=dict(default='tag', required=False, choices=['tag', 'id']),
|
||||||
propagating_vgw_ids = dict(default=None, required=False, type='list'),
|
propagating_vgw_ids=dict(default=None, required=False, type='list'),
|
||||||
purge_routes=dict(default=True, type='bool'),
|
purge_routes=dict(default=True, type='bool'),
|
||||||
purge_subnets=dict(default=True, type='bool'),
|
purge_subnets=dict(default=True, type='bool'),
|
||||||
route_table_id = dict(default=None, required=False),
|
route_table_id=dict(default=None, required=False),
|
||||||
routes = dict(default=[], required=False, type='list'),
|
routes=dict(default=[], required=False, type='list'),
|
||||||
state = dict(default='present', choices=['present', 'absent']),
|
state=dict(default='present', choices=['present', 'absent']),
|
||||||
subnets = dict(default=None, required=False, type='list'),
|
subnets=dict(default=None, required=False, type='list'),
|
||||||
tags = dict(default=None, required=False, type='dict', aliases=['resource_tags']),
|
tags=dict(default=None, required=False, type='dict', aliases=['resource_tags']),
|
||||||
vpc_id = dict(default=None, required=True)
|
vpc_id=dict(default=None, required=True)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue