Created
April 10, 2014 08:34
-
-
Save vinyar/10356830 to your computer and use it in GitHub Desktop.
Using knife search with Windows IIS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: iis_demo | |
# Recipe:: default | |
# | |
# Copyright 2014, YOUR_COMPANY_NAME | |
# | |
# 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 | |
search("countries", "*:*").each do |db_item| | |
template "c:\\inetpub\\wwwroot\\#{db_item["country"]}.htm" do | |
source "countries.htm.erb" | |
variables( | |
:capital => db_item["capital"], | |
:country => db_item["country"] | |
) | |
end | |
end | |
# db.each do |item| | |
# country_data = data_bag_item("countries", item) | |
# countryname = country_data["country"] | |
# capitalname = country_data["capital"] | |
# # require 'pry'; binding.pry | |
# 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