Skip to content

Instantly share code, notes, and snippets.

@joeypiccola
Created September 11, 2018 04:39
Show Gist options
  • Save joeypiccola/51efedc0d73ba220ee77e170e6bf04e4 to your computer and use it in GitHub Desktop.
Save joeypiccola/51efedc0d73ba220ee77e170e6bf04e4 to your computer and use it in GitHub Desktop.
# == Class: profile::web::config_demo
class profile::web::config_demo (
$websitename = 'LetsDoThis',
$zipname = 'website.zip',
$sourcerepo = 'http://repo.ad.piccola.us:8081/',
$destinationpath = 'C:\inetpub\LetsDoThis',
$defaultwebsitepath = 'C:\inetpub\wwwroot',
$zippath = 'C:\tmp'
){
$zipuri = "${sourcerepo}/${zipname}"
$zipfile = "${zippath}\\${zipname}"
# Install the IIS role
dsc_windowsfeature {'IIS':
dsc_ensure => 'present',
dsc_name => 'Web-Server',
} ->
# Install the ASP .NET 4.5 role
dsc_windowsfeature {'AspNet45':
dsc_ensure => 'present',
dsc_name => 'Web-Asp-Net45',
} ->
# Install console
dsc_windowsfeature {'console':
dsc_ensure => 'present',
dsc_name => 'Web-Mgmt-Console',
} ->
# Stop the existing website
dsc_xwebsite {'Stop DefaultSite':
dsc_ensure => 'present',
dsc_name => 'Default Web Site',
dsc_state => 'Stopped',
dsc_physicalpath => $defaultwebsitepath,
} ->
# Create tmp folder
dsc_file {'tmp folder':
dsc_ensure => 'present',
dsc_type => 'Directory',
dsc_destinationpath => $zippath,
} ->
# Download the site content
dsc_xremotefile {'Download website Zip':
dsc_destinationpath => $zipfile,
dsc_uri => $zipuri,
} ->
# Extract the website content
dsc_archive {'Unzip and Copy the website':
dsc_ensure => 'present',
dsc_path => $zipfile,
dsc_destination => $destinationpath,
} ->
# Create a new website
dsc_xwebsite {'LetsDoThis':
dsc_ensure => 'present',
dsc_name => $websitename,
dsc_state => 'Started',
dsc_physicalpath => $destinationpath,
dsc_bindinginfo => [
{
protocol => 'http',
port => 8080,
}
],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment