Demo: Chef and Google Compute Engine
Example: Install Apache
1 apt_package "apache" do
2 action :install
3 end
4
5 service "apache" do
6 action [:enable, :start]
7 end
8
9 template "/var/www/index.html" do
10 source "index.html.erb"
11 action :create
12 mode "644"
13 end
Example: Create a Compute Engine instance
1 gce_instance "gce-chef" do
2 machine_type "n1-standard-1"
3 boot_disk_image "debian-7-wheezy-v20140606"
4 tags ["DevOps", "Google", "Chef"]
5 metadata "demo"=>"chef", "foo"=>"bar"
6 auto_restart true
7 on_host_maintenance "MIGRATE"
8 wait_for false
9 first_boot_json "/etc/chef/first_boot_json"
10 client_rb "/etc/chef/client.rb"
11 validation_pem "/etc/chef/validation.pem"
12 action :create
13 end