From: Lorin Hochstein Date: Sat, 11 Feb 2017 19:46:52 +0000 (-0800) Subject: Working on updating vpc scripts X-Git-Url: https://git.halfball.org/?a=commitdiff_plain;h=8a3504be6b414cf7f424caad2e1f684d4f9b4bc9;p=ansiblebook.git Working on updating vpc scripts --- diff --git a/ch12/playbooks/create-vpc.yml b/ch12/playbooks/create-vpc.yml index 6ec0e25..8d05c6d 100644 --- a/ch12/playbooks/create-vpc.yml +++ b/ch12/playbooks/create-vpc.yml @@ -2,29 +2,17 @@ - name: create vpc hosts: localhost gather_facts: False + vars: + region: us-west-1 tasks: - - name: create a vpc - ec2_vpc: - internet_gateway: True - region: us-west-1 - resource_tags: { Name: "Book example", env: production } - cidr_block: 10.0.0.0/16 - subnets: - - cidr: 10.0.0.0/24 - resource_tags: - env: production - tier: web - - cidr: 10.0.1.0/24 - resource_tags: - env: production - tier: db - route_tables: - - subnets: - - 10.0.0.0/24 - - 10.0.1.0/24 - routes: - - dest: 0.0.0.0/0 - gw: igw - register: vpc - - name: print out vpc - debug: var=vpc + - name: create a vpc + ec2_vpc_net: + region: "{{ region }}" + name: "Book example" + cidr_block: 10.0.0.0/16 + tags: + env: production + register: vpc + - debug: var=vpc + + diff --git a/ch12/playbooks/old-create-vpc.yml b/ch12/playbooks/old-create-vpc.yml new file mode 100644 index 0000000..6ec0e25 --- /dev/null +++ b/ch12/playbooks/old-create-vpc.yml @@ -0,0 +1,30 @@ +--- +- name: create vpc + hosts: localhost + gather_facts: False + tasks: + - name: create a vpc + ec2_vpc: + internet_gateway: True + region: us-west-1 + resource_tags: { Name: "Book example", env: production } + cidr_block: 10.0.0.0/16 + subnets: + - cidr: 10.0.0.0/24 + resource_tags: + env: production + tier: web + - cidr: 10.0.1.0/24 + resource_tags: + env: production + tier: db + route_tables: + - subnets: + - 10.0.0.0/24 + - 10.0.1.0/24 + routes: + - dest: 0.0.0.0/0 + gw: igw + register: vpc + - name: print out vpc + debug: var=vpc