Skip to content

Instantly share code, notes, and snippets.

@filipenf
Last active February 18, 2016 11:18
Show Gist options
  • Save filipenf/fe6ed0ed3a50003def2e to your computer and use it in GitHub Desktop.
Save filipenf/fe6ed0ed3a50003def2e to your computer and use it in GitHub Desktop.
---
- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: "Create project VPC"
ec2_vpc:
state: present
region: "{{ project_region }}"
resource_tags: { "Environment":"{{ project_env }}", "Name":"{{ project_name }}" }
cidr_block: "{{ project_cidr_block }}"
subnets: "{{ project_subnets }}"
internet_gateway: True
route_tables: "{{ project_routes }}"
wait: yes
register: myvpc
- debug: var=myvpc
when: show_debug
vars:
project_region: us-east
project_cidr_block: 10.10.0.0/16
project_name: ProductName
project_desc: Product Name
project_env: dev
project_subnets:
- cidr: 10.10.0.0/23
az: us-east-1a
resource_tags: { "Name":"{{ project_name }}-External-a", "Description":"{{ project_desc }} - External a" }
- cidr: 10.10.16.0/23
az: us-east-1a
resource_tags: { "Name":"{{ project_name }}-Internal-a", "Description":"{{ project_desc }} - Internal a" }
project_routes:
- subnets:
- 10.10.0.0/23
- 10.10.16.0/23
routes:
- dest: 0.0.0.0/0
gw: igw
resource_tags: { "Name":"{{ project_name }}-Main", "Description":"{{ project_desc }} - Main Route Table" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment