Using the Chef IIS cookbook to build a site/appPool

Because the documentation is sparse, figured I'd post these up.  Spent way more time & trial/error than I should have had to!!  (I was going to post these weeks ago, but didn't get it working until the kindly devs at opscode resolved the bugs.  Note that the fix hasn't actually been published yet, but all this works with the repo linked from here: )

Create the directory:
directory "C:\\Web\\Data\\#{cookbook_name}" do
  action :create
  recursive true
  rights :full_control, "Administrators", :applies_to_children => true
  rights :full_control, "domain\\username", :applies_to_children => true
  rights :full_control, "domain\\group name", :applies_to_children => true
  not_if {"C:\\Web\\Data\\#{cookbook_name}") }

Create an appPool:
 iis_pool "#{cookbook_name}" do
     runtime_version "4.0"
     pipeline_mode :Integrated
     pool_username "domain\\username"
pool_password "password"
action [:add,:config]

Recycle the appPool:
 iis_pool "#{cookbook_name}" do
    action :recycle

Create a website:
 iis_site "#{cookbook_name}" do
path "c:\\web\\data\\#{cookbook_name}\\files"
site_name "#{cookbook_name}"
application_pool "#{cookbook_name}"
action [:add,:start]

Configure the bindings:
 iis_site "#{cookbook_name}" do
bindings "http/*"
action [:config,:restart]

Note that you can do multiple bindings, just comma-separate inside those quotes.
e.g. bindings "http/*,https/*"


Popular posts from this blog

Learning through failure - a keyboard creation journey

Learning Opportunities - Watching/listening list

DFSR - eventid 4312 - replication just won't work