Skip to content

Commit

Permalink
Replace Seek DSC resources with xWebAdministration modules (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
mefellows committed Jan 14, 2015
1 parent 6e57741 commit 2448de0
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 26 deletions.
7 changes: 5 additions & 2 deletions development/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
# vi: set ft=ruby :

$shell_script = <<SCRIPT
(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')))>$null 2>&1
choco install seek-dsc
#(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')))>$null 2>&1
#choco install seek-dsc
(New-Object System.Net.WebClient).DownloadFile('https://gallery.technet.microsoft.com/scriptcenter/xWebAdministration-Module-3c8bb6be/file/131367/3/xWebAdministration_1.3.2.zip','c:\\xwebadmin.zip')
choco install 7zip
& 'C:\\Program Files\\7-Zip\\7z.exe' x C:\\xwebadmin.zip -o'C:\\Program Files\\WindowsPowerShell\\Modules'
Get-DSCResource
SCRIPT

Expand Down
18 changes: 10 additions & 8 deletions development/manifests/MyWebsite.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Configuration MyWebsite
{
param ($MachineName)

Import-DscResource -Module cWebAdministration
Import-DscResource -Module MyWebapp
Import-DscResource -Module cNetworking

Node $MachineName
{
Expand All @@ -12,15 +12,17 @@ Configuration MyWebsite
Ensure = "Present"
Name = "Web-Server"
}
cWebsite DefaultWebsite

cFirewallRule webFirewall
{
Name = "Default Web Site"
ApplicationPool = "DefaultAppPool"
PhysicalPath = "$env:SystemDrive\inetpub\wwwroot"
Ensure = "Absent"
DependsOn = '[WindowsFeature]IIS'
Name = "WebFirewallOpen"
Direction = "Inbound"
LocalPort = "80"
Protocol = "TCP"
Action = "Allow"
Ensure = "Present"
}

SimpleWebsite sWebsite
{
WebAppPath = "c:\my-new-webapp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,41 @@
[HashTable]$AuthenticationInfo = @{Anonymous = "true"; Basic = "false"; Digest = "false"; Windows = "false"}
)

Import-DscResource -Module cWebAdministration
# Import-DscResource -Module cWebAdministration
Import-DscResource -Module xWebAdministration

# Create the new Website
cWebsite Basic
{
Ensure = 'Present'
Name = $WebAppName
PhysicalPath = $WebAppPath
ApplicationPool = "DefaultAppPool"
AuthenticationInfo = SEEK_cWebAuthenticationInformation
{
Anonymous = $AuthenticationInfo.Anonymous
Basic = $AuthenticationInfo.Basic
Digest = $AuthenticationInfo.Digest
Windows = $AuthenticationInfo.Windows
}
DependsOn = '[File]website'
# Stop the default website
xWebsite DefaultSite
{
Ensure = "Present"
Name = "Default Web Site"
State = "Stopped"
PhysicalPath = "C:\inetpub\wwwroot"
DependsOn = "[File]websiteIndex"
}

# Create a Web Application Pool
xWebAppPool NewWebAppPool
{
Name = "${WebAppName}AppPool"
Ensure = "Present"
State = "Started"
}

#Create a New Website with Port
xWebSite NewWebSite
{
Name = $WebAppName
Ensure = "Present"
BindingInfo = MSFT_xWebBindingInformation
{
Port = 80
}
PhysicalPath = $WebAppPath
State = "Started"
DependsOn = @("[xWebAppPool]NewWebAppPool")
}

File websiteIndex
{
Ensure = "Present"
Expand Down

0 comments on commit 2448de0

Please sign in to comment.