Skip to content

Latest commit

 

History

History
100 lines (66 loc) · 3.09 KB

getting-started.md

File metadata and controls

100 lines (66 loc) · 3.09 KB

Getting started

Workspace overview

The DevOps Kit for Dsc uses a workspace to store reusable configuration information. A workspace can be any directory local or remote with read/write access.

An example of the workspace folder structure is shown below.

  • root
    • .dokd - contains workspace settings.json
    • build - contains built .mof files
    • nodes - contains node data .psd1 files
    • src
      • SharePoint - contains SharePoint server configuration scripts

Create a workspace

To create a workspace use the Initialize-DOKDsc cmdlet (dokd-init for short). For a list of cmdlet options see Initialize-DOKDsc.

# Create a new workspace in the current path
Initialize-DOKDsc;

Create a collection

A collection allows you to associate a configuration script and the nodes that will be configured. Multiple collections can exist within a single workspace and may be used to seperate environments such as Test / Production or diffent workloads such as SQL / SharePoint depeneding on your needs.

Create a new configuration named Production. A new configuration script will be created by default at src\Configuration\Production.ps1.

# Create a configuration named Production
New-DOKDscCollection -Name 'Production';

Create a new configuration named Production using an existing configuration script at src\Configuration\Production.ps1.

New-DOKDscCollection -Name 'Production' -Path '.\src\Configuration\Production.ps1'

Build a collection

After a configuration script and nodes have been defined, the configuration can be built using the Invoke-DOKDscBuild cmdlet.

# Build all collections. To build a specific collection use the -Name parameter
Invoke-DOKDscBuild;

After the collection is built, .mof files will be output in the .\build directory.

Restore dependencies

If you already have a workspace stored in a source control system you may want to just restore dependencies to your local copy.

Module dependencies are restored with the Restore-DOKDscModule cmdlet (dokd-restore for short). For a list of cmdlet options see Restore-DOKDscModule.

# Use git to clone the repository
git clone https://github.com/BernieWhite/DevOpsKitDsc-samples.git;

cd .\DevOpsKitDsc-samples

# Restore dependency modules to the workspace in the current path
Restore-DOKDscModule;

Full examples

Building a new DSC configuration

# Create a workspace in the current working path
Initialize-DOKDsc;

# Add a dependency module
Add-DOKDscModule -ModuleName 'SharePointDsc' -ModuleVersion '1.8.0.0';

# Create a collection
New-DOKDscCollection 'SharePoint';

# Build all collections
Invoke-DOKDscBuild;

Building a cloned git repository

# Use git to clone the repository
git clone https://github.com/BernieWhite/DevOpsKitDsc-example.git;

cd .\DevOpsKitDsc-example

# Restore dependency modules to the workspace
Restore-DOKDscModule;

# Build all collections
Invoke-DOKDscBuild;