mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 03:00:23 -07:00
Included an example using the jinja 2 map function to return a list of (#2458)
subnet_ids.
This commit is contained in:
parent
bc78913c6b
commit
1bcfc082e0
1 changed files with 15 additions and 0 deletions
|
@ -58,6 +58,21 @@ EXAMPLES = '''
|
||||||
filters:
|
filters:
|
||||||
vpc-id: vpc-abcdef00
|
vpc-id: vpc-abcdef00
|
||||||
|
|
||||||
|
# Gather facts about a set of VPC subnets, publicA, publicB and publicC within a
|
||||||
|
# VPC with ID vpc-abcdef00 and then use the jinja map function to return the
|
||||||
|
# subnet_ids as a list.
|
||||||
|
|
||||||
|
- ec2_vpc_subnet_facts:
|
||||||
|
filters:
|
||||||
|
vpc-id: vpc-abcdef00
|
||||||
|
"tag:Name": "{{ item }}"
|
||||||
|
with_items:
|
||||||
|
- publicA
|
||||||
|
- publicB
|
||||||
|
- publicC
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
subnet_ids: "{{ subnet_facts.results|map(attribute='subnets.0.id')|list }}"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue