- name: create vpcs
ec2_vpc:
state: '{{ item.state }}'
region: '{{ item.region }}'
vpc_id: '{{ item.vpc_id }}'
cidr_block: '{{ item.cidr_block }}'
subnets: '{{ item.subnets }}'
internet_gateway: '{{ item.internet_gateway }}'
route_tables:
- subnets: '{{ item.route_tables.private_subnets.subnets }}'
routes:
- dest: '{{ item.route_tables.private_subnets.routes.dest }}'
- subnets: '{{ item.route_tables.public_subnets.subnets }}'
routes:
- dest: '{{ item.route_tables.public_subnets.routes.dest }}'
with_items: vpcs
register: vpc