From 061b2f30823cde2fb7d73a151dc96bc5e8001e64 Mon Sep 17 00:00:00 2001 From: Lorin Hochstein Date: Sun, 12 Feb 2017 17:15:28 -0800 Subject: [PATCH] add local versions of files --- ch12/packer/web-ami-local.yml | 6 +++++ ch12/packer/{web.json => web-local.json} | 2 +- ch12/packer/web-pb.json | 30 ++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 ch12/packer/web-ami-local.yml rename ch12/packer/{web.json => web-local.json} (92%) create mode 100644 ch12/packer/web-pb.json diff --git a/ch12/packer/web-ami-local.yml b/ch12/packer/web-ami-local.yml new file mode 100644 index 0000000..53d0af5 --- /dev/null +++ b/ch12/packer/web-ami-local.yml @@ -0,0 +1,6 @@ +--- +- name: configure a webserver as an ami + hosts: localhost + become: True + roles: + - web diff --git a/ch12/packer/web.json b/ch12/packer/web-local.json similarity index 92% rename from ch12/packer/web.json rename to ch12/packer/web-local.json index 90e67a9..4d53588 100644 --- a/ch12/packer/web.json +++ b/ch12/packer/web-local.json @@ -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 index 0000000..a74b421 --- /dev/null +++ b/ch12/packer/web-pb.json @@ -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" + } + ] +} -- 2.44.0