johnfitzpatrick
3/22/2014 - 2:48 PM

default.rb

#
# Cookbook Name:: iis_demo
# Recipe:: default
#
# Copyright 2014, Chef Workshops, Inc.
#
# All rights reserved - Do Not Redistribute
#
powershell_script "Install IIS" do 
  code "add-windowsfeature Web-Server"
  action :run
end

service "w3svc" do
  action [ :enable, :start ]
end

db = data_bag("countries")
template 'c:\inetpub\wwwroot\Default.htm' do
	source "Default.htm.erb"
	variables(
		:country => db
	    )
end

data_bag("countries").each do |item|
  country_data = data_bag_item("countries", item)
  countryname = country_data["country"]
  capitalname = country_data["capital"]

	template "c:\\inetpub\\wwwroot\\#{countryname}.htm" do
	  source "countries.htm.erb"
	  variables(
	      :capital => capitalname,
	      :country => countryname
	    )
	end
end