Working on updating vpc scripts
authorLorin Hochstein <lhochstein@netflix.com>
Sat, 11 Feb 2017 19:46:52 +0000 (11:46 -0800)
committerLorin Hochstein <lhochstein@netflix.com>
Sat, 11 Feb 2017 19:49:01 +0000 (11:49 -0800)
ch12/playbooks/create-vpc.yml
ch12/playbooks/old-create-vpc.yml [new file with mode: 0644]

index 6ec0e25..8d05c6d 100644 (file)
@@ -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 (file)
index 0000000..6ec0e25
--- /dev/null
@@ -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