Skip to content

Commit

Permalink
Update ec2_eip_facts.py (#53040)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bhandeland authored and acozine committed Apr 26, 2019
1 parent 52a1e4a commit 1e2cbef
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/ansible/modules/cloud/amazon/ec2_eip_facts.py
Expand Up @@ -52,6 +52,24 @@
- 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
'''


Expand Down

0 comments on commit 1e2cbef

Please sign in to comment.