- name: create all vpc's for all accounts and regions
ec2_vpc:
state: "{{ item.internet_gateway | default('no') }}"
region: "{{ item.region }}"
state: "{{ item.state | default('present') }}"
cidr_block: "{{ item.cidr_block }}"
resource_tags: "{{ item.resource_tags }}"
subnets: "{{ item.subnets }}"
wait: yes
when: item.controlEnvironment == env
with_items: "{{ vpcList }}"
register: vpcOut
- set_fact:
mainVpcId: "{{ item.vpc_id }}"
with_items: vpcOut.results
when:
- not item | skipped
- item.item.resource_tags.WhichRegion == 'mainRegion'
- set_fact:
with_items: vpcOut.results
when:
- not item | skipped
- item.item.resource_tags.WhichRegion == 'mainRegion'
- set_fact:
with_items: vpcOut.results
when:
- not item | skipped
- item.item.resource_tags.WhichRegion == 'mainRegion'
- set_fact:
with_items: vpcOut.results
when:
- not item | skipped
- item.item.resource_tags.WhichRegion == 'mainRegion'