mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
ec2.py: filter by client-token if id is specified (#26114)
fixes #26021
This commit is contained in:
parent
1300680d30
commit
25a9ababcc
1 changed files with 7 additions and 0 deletions
|
@ -707,6 +707,9 @@ def get_reservations(module, ec2, vpc, tags=None, state=None, zone=None):
|
||||||
if zone:
|
if zone:
|
||||||
filters.update({'availability-zone': zone})
|
filters.update({'availability-zone': zone})
|
||||||
|
|
||||||
|
if module.params.get('id'):
|
||||||
|
filters['client-token'] = module.params['id']
|
||||||
|
|
||||||
results = ec2.get_all_instances(filters=filters)
|
results = ec2.get_all_instances(filters=filters)
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
@ -1423,6 +1426,8 @@ def startstop_instances(module, ec2, instance_ids, state, instance_tags):
|
||||||
for key, value in instance_tags.items():
|
for key, value in instance_tags.items():
|
||||||
filters["tag:" + key] = value
|
filters["tag:" + key] = value
|
||||||
|
|
||||||
|
if module.params.get('id'):
|
||||||
|
filters['client-token'] = module.params['id']
|
||||||
# Check that our instances are not in the state we want to take
|
# Check that our instances are not in the state we want to take
|
||||||
|
|
||||||
# Check (and eventually change) instances attributes and instances state
|
# Check (and eventually change) instances attributes and instances state
|
||||||
|
@ -1548,6 +1553,8 @@ def restart_instances(module, ec2, instance_ids, state, instance_tags):
|
||||||
if instance_tags:
|
if instance_tags:
|
||||||
for key, value in instance_tags.items():
|
for key, value in instance_tags.items():
|
||||||
filters["tag:" + key] = value
|
filters["tag:" + key] = value
|
||||||
|
if module.params.get('id'):
|
||||||
|
filters['client-token'] = module.params['id']
|
||||||
|
|
||||||
# Check that our instances are not in the state we want to take
|
# Check that our instances are not in the state we want to take
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue