From: Lorin Hochstein Date: Sat, 11 Feb 2017 20:36:58 +0000 (-0800) Subject: create subnets and routes X-Git-Url: https://git.halfball.org/?a=commitdiff_plain;h=1514204272f6913d0f5ab2fc0a5c4be1011484af;p=ansiblebook.git create subnets and routes --- diff --git a/ch12/playbooks/create-vpc.yml b/ch12/playbooks/create-vpc.yml index 8d05c6d..9dce009 100644 --- a/ch12/playbooks/create-vpc.yml +++ b/ch12/playbooks/create-vpc.yml @@ -12,7 +12,37 @@ cidr_block: 10.0.0.0/16 tags: env: production - register: vpc - - debug: var=vpc - - + register: result + - set_fact: "vpc_id={{ result.vpc.id }}" + - name: add gateway + ec2_vpc_igw: + region: "{{ region }}" + vpc_id: "{{ vpc_id }}" + - name: create web subnet + ec2_vpc_subnet: + region: "{{ region }}" + vpc_id: "{{ vpc_id }}" + cidr: 10.0.0.0/24 + tags: + env: production + tier: web + - name: create db subnet + ec2_vpc_subnet: + region: "{{ region }}" + vpc_id: "{{ vpc_id }}" + cidr: 10.0.1.0/24 + tags: + env: production + tier: db + - name: set routes + ec2_vpc_route_table: + region: "{{ region }}" + vpc_id: "{{ vpc_id }}" + tags: + purpose: permit-outbound + subnets: + - 10.0.0.0/24 + - 10.0.1.0/24 + routes: + - dest: 0.0.0.0/0 + gateway_id: igw