add local versions of files
authorLorin Hochstein <lhochstein@netflix.com>
Mon, 13 Feb 2017 01:15:28 +0000 (17:15 -0800)
committerLorin Hochstein <lhochstein@netflix.com>
Mon, 13 Feb 2017 01:15:28 +0000 (17:15 -0800)
ch12/packer/web-ami-local.yml [new file with mode: 0644]
ch12/packer/web-local.json [moved from ch12/packer/web.json with 92% similarity]
ch12/packer/web-pb.json [new file with mode: 0644]

diff --git a/ch12/packer/web-ami-local.yml b/ch12/packer/web-ami-local.yml
new file mode 100644 (file)
index 0000000..53d0af5
--- /dev/null
@@ -0,0 +1,6 @@
+---
+- name: configure a webserver as an ami
+  hosts: localhost
+  become: True
+  roles:
+    - web
similarity index 92%
rename from ch12/packer/web.json
rename to ch12/packer/web-local.json
index 90e67a9..4d53588 100644 (file)
@@ -23,7 +23,7 @@
     },
     {
       "type": "ansible-local",
-      "playbook_file": "web-ami.yml",
+      "playbook_file": "web-ami-local.yml",
       "role_paths": [
         "../playbooks/roles/web"
       ]
diff --git a/ch12/packer/web-pb.json b/ch12/packer/web-pb.json
new file mode 100644 (file)
index 0000000..a74b421
--- /dev/null
@@ -0,0 +1,30 @@
+{
+  "builders": [
+    {
+      "type": "amazon-ebs",
+      "region": "us-west-1",
+      "source_ami": "ami-79df8219",
+      "instance_type": "t2.micro",
+      "ssh_username": "ubuntu",
+      "ami_name": "web-nginx-{{timestamp}}",
+      "tags": {
+        "Name": "web-nginx"
+      }
+    }
+  ],
+  "provisioners": [
+    {
+      "type": "shell",
+      "inline": [
+        "sleep 30",
+        "sudo apt-get update",
+        "sudo apt-get install -y ansible"
+      ]
+    },
+    {
+      "type": "ansible-local",
+      "playbook_file": "web-ami-local.yml",
+      "playbook_dir": "../playbooks"
+    }
+  ]
+}