Skip to content

Commit

Permalink
Remove example 'Creating the default website using configuration data…
Browse files Browse the repository at this point in the history
…' from README.md (#496)

- Changes to xWebAdministration
  - Remove example 'Creating the default website using configuration data' from README.md (issue #488).
  • Loading branch information
Tuxhedoh authored and johlju committed Oct 1, 2019
1 parent 3e02850 commit bf23883
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 93 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Changes to xWebAdministration
- Resolved custom Script Analyzer rules that was added to the test framework.
- Moved change log from README.md to a separate CHANGELOG.md ([issue #446](https://github.com/PowerShell/xWebAdministration/issues/446)).
- Remove example 'Creating the default website using configuration data' from README.md ([issue #488](https://github.com/PowerShell/xWebAdministration/issues/488)).
- Removed examples README.md as it was obsolete ([issue #482](https://github.com/PowerShell/xWebAdministration/issues/482)).
- Changes to xWebsite
- Fix `Get-TargetResource` so that `LogFlags` are returned as expected
Expand Down
93 changes: 0 additions & 93 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -715,99 +715,6 @@ Configuration Sample_xWebsite_NewWebsite
}
```

### Creating the default website using configuration data

In this example, we’ve moved the parameters used to generate the website into a configuration data file.
All of the variant portions of the configuration are stored in a separate file.
This can be a powerful tool when using DSC to configure a project that will be deployed to multiple environments.
For example, users managing larger environments may want to test their configuration on a small number of machines before deploying it across many more machines in their production environment.

Configuration files are made with this in mind.
This is an example configuration data file (saved as a .psd1).

```powershell
Configuration Sample_xWebsite_FromConfigurationData
{
# Import the module that defines custom resources
Import-DscResource -Module xWebAdministration
# Dynamically find the applicable nodes from configuration data
Node $AllNodes.where{$_.Role -eq "Web"}.NodeName
{
# Install the IIS role
WindowsFeature IIS
{
Ensure = "Present"
Name = "Web-Server"
}
# Install the ASP .NET 4.5 role
WindowsFeature AspNet45
{
Ensure = "Present"
Name = "Web-Asp-Net45"
}
# Stop an existing website (set up in Sample_xWebsite_Default)
xWebsite DefaultSite
{
Ensure = "Present"
Name = "Default Web Site"
State = "Stopped"
PhysicalPath = $Node.DefaultWebSitePath
DependsOn = "[WindowsFeature]IIS"
}
# Copy the website content
File WebContent
{
Ensure = "Present"
SourcePath = $Node.SourcePath
DestinationPath = $Node.DestinationPath
Recurse = $true
Type = "Directory"
DependsOn = "[WindowsFeature]AspNet45"
}
# Create a new website
xWebsite BakeryWebSite
{
Ensure = "Present"
Name = $Node.WebsiteName
State = "Started"
PhysicalPath = $Node.DestinationPath
DependsOn = "[File]WebContent"
}
}
}
# Content of configuration data file (e.g. ConfigurationData.psd1) could be:
# Hashtable to define the environmental data
@{
# Node specific data
AllNodes = @(
# All the WebServer has following identical information
@{
NodeName = "*"
WebsiteName = "FourthCoffee"
SourcePath = "C:\BakeryWebsite\"
DestinationPath = "C:\inetpub\FourthCoffee"
DefaultWebSitePath = "C:\inetpub\wwwroot"
},
@{
NodeName = "WebServer1.fourthcoffee.com"
Role = "Web"
},
@{
NodeName = "WebServer2.fourthcoffee.com"
Role = "Web"
}
);
}
# Pass the configuration data to configuration as follows:
Sample_xWebsite_FromConfigurationData -ConfigurationData ConfigurationData.psd1
```

### All resources (end-to-end scenario)

```powershell
Expand Down

0 comments on commit bf23883

Please sign in to comment.