Skip to content

Instantly share code, notes, and snippets.

@johnfitzpatrick
Created March 22, 2014 14:48
Show Gist options
  • Save johnfitzpatrick/9708352 to your computer and use it in GitHub Desktop.
Save johnfitzpatrick/9708352 to your computer and use it in GitHub Desktop.
#
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment