Skip to content

Instantly share code, notes, and snippets.

@echohack
Created April 25, 2016 19:24
Show Gist options
  • Save echohack/4aa876f436c771a0aef4cf08abdd257c to your computer and use it in GitHub Desktop.
Save echohack/4aa876f436c771a0aef4cf08abdd257c to your computer and use it in GitHub Desktop.
Example web config for iis using dsc + chef
configuration iis_web_config
{
Import-DscResource -Module xWebAdministration
xWebsite DefaultWebSite
{
Name = "<%= @site_name %>"
Ensure = "Present"
PhysicalPath = "<%= @site_path %>"
State = "Started"
}
xWebAppPool myFace
{
Name = "myFace"
Ensure = "Present"
State = "Started"
}
Script AppPoolIdentity
{
TestScript = {
Import-Module WebAdministration
return (Get-Item IIS:\AppPools\myFace).processModel.username -eq "<%= @app_pool_user %>"
}
SetScript = {
Import-Module WebAdministration
$pool = get-item IIS:\AppPools\myFace
$pool.processModel.username = "<%= @app_pool_user %>"
$pool.processModel.password = "<%= @app_pool_pswd %>"
$pool.processModel.identityType = 3
$pool | set-item
}
GetScript = {
Import-Module WebAdministration
$pool = Get-Item IIS:\AppPools\myFace
return @{
ProcessModel = $pool.processModel
}
}
}
xWebApplication myFace
{
Name = "myFace"
Website = "<%= @site_name %>"
WebAppPool = "myFace"
Ensure = "Present"
PhysicalPath = "<%= @myFace_path %>"
}
xWebApplication sso
{
Name = "myFace/sso"
Website = "<%= @site_name %>"
WebAppPool = "myFace"
Ensure = "Present"
PhysicalPath = "<%= @sso_path %>"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment