Skip to content

Instantly share code, notes, and snippets.

@richm
Created March 11, 2021 16:15
Show Gist options
  • Save richm/3fed3cbf15e8e891fc59892a5937ae18 to your computer and use it in GitHub Desktop.
Save richm/3fed3cbf15e8e891fc59892a5937ae18 to your computer and use it in GitHub Desktop.
- hosts: localhost
vars:
result:
vpc:
cidr_block_association_set:
- id: block1
cidr_block: 192.168.122.0/24
cidr_block_state:
state: present
- id: block2
cidr_block: 192.168.123.0/24
cidr_block_state:
state: disabled
tasks:
- debug:
msg: blocks {{ result.vpc.cidr_block_association_set | map(attribute="cidr_block") | list }}
run like this:
ANSIBLE_STDOUT_CALLBACK=debug ansible-playbook -vv vpc-test.yml
output:
MSG:
blocks ['192.168.122.0/24', '192.168.123.0/24']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment