Skip to content

Instantly share code, notes, and snippets.

@IslandUsurper
Last active June 15, 2016 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IslandUsurper/3bb8712f4603eae38f030ea2de546a93 to your computer and use it in GitHub Desktop.
Save IslandUsurper/3bb8712f4603eae38f030ea2de546a93 to your computer and use it in GitHub Desktop.
Setting up VPC subnets
- name: Create VPC
ec2_vpc_net:
cidr_block: 10.0.0.0/16
name: {{ Environment }}
state: present
tenancy: default
register: vpc
- name: Create Internet gateway
ec2_vpc_igw: vpc_id={{ vpc.vpc.id }} state=present
register: igw
- name: Create Private subnets
ec2_vpc_subnet:
az: "{{ item.az }}"
cidr: "{{ item.cidr }}"
tags: "{{ item.tags }}"
vpc_id: "{{ vpc.vpc.id }}"
state: present
with_items: "{{ private_subnets }}"
register: private
- name: Create Public subnets
ec2_vpc_subnet:
az: "{{ item.az }}"
cidr: "{{ item.cidr }}"
tags: "{{ item.tags }}"
vpc_id: "{{ vpc.vpc.id }}"
state: present
with_items: "{{ public_subnets }}"
register: public
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment