mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-27 02:30:22 -07:00
Update ec2_eip_facts.py (#53040)
Add several additional examples showing how to filter on tag, how to filter on the EIP allocation id, and how to set a fact using the output.
This commit is contained in:
parent
52a1e4a599
commit
1e2cbefac0
1 changed files with 18 additions and 0 deletions
|
@ -52,6 +52,24 @@ EXAMPLES = '''
|
|||
- i-987654321
|
||||
register: my_vms_eips
|
||||
|
||||
# List all EIP addresses using the 'Name' tag as a filter.
|
||||
- ec2_eip_facts:
|
||||
filters:
|
||||
tag:Name: www.example.com
|
||||
register: my_vms_eips
|
||||
|
||||
# List all EIP addresses using the Allocation-id as a filter
|
||||
- ec2_eip_facts:
|
||||
filters:
|
||||
allocation-id: eipalloc-64de1b01
|
||||
register: my_vms_eips
|
||||
|
||||
# Set the variable eip_alloc to the value of the first allocation_id
|
||||
# and set the variable my_pub_ip to the value of the first public_ip
|
||||
- set_fact:
|
||||
eip_alloc: my_vms_eips.addresses[0].allocation_id
|
||||
my_pub_ip: my_vms_eips.addresses[0].public_ip
|
||||
|
||||
'''
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue