Configuration Management
comes to Windows
Ravikanth Chaganti
Dell
MVP, Windows PowerShell
Founder, PowerShell Magazine
Lea...
How many of you heard
and/or used PowerShell?
What every CIO or IT
administrator want?
Continuous Service Availability
Continuous Rapid Release Cycle
Continuous Deploym...
Desired State Configuration
Enables you to ensure that the components of your
data center have the correct configuration
A...
DSC - How do you get it?
• Windows Server 2012 R2
• Windows 8.1
• Windows Management Framework 4.0
▫ Windows Server 2012
▫...
DSC - Basics
Configuration ArchiveDemo {
Node SRV3-WS2012R2 {
Archive ArchiveDemo {
Path = "10.10.10.101BackupScripts.zip"...
DSC - Resources
Archive

Environment

File

Group

Log

Package

Process

Registry

Role

Script

Service

User

… Of cour...
Demo
DSC Resources
Writing Custom Resources
• Create a MOF file describing the resource
• Create a PowerShell Module (PSM1 & PSD1)
▫
▫
▫
▫

S...
Custom Resource MOF
[version("1.0.0"), FriendlyName("HostsFile")]
class HostsFile : MSFT_BaseResourceConfiguration
{
[Key]...
Custom Resource Module
• Same parameters on
▫ Get-TargetResource
 Must return hashtable of the configuration

▫ Set-Targe...
Resource Execution Flow
Start

Run
TestTargetResource
False
Run
SetTargetResource

End

True
Local Configuration Manager
• Each computer with PS 4.0 runs a DSC Engine (as
SYSTEM)
• Responsible for calling the DSC re...
Configuration Delivery
• Push
▫ Default delivery mechanism
▫ Start-DSCConfiguration

• Pull
▫ DSC Service
▫ IIS Endpoint o...
Push Model
Authoring Phase
(May include
imperative as well as
declarative code)

PS V1, V2,
V3

PS V4***

Staging Phase
- ...
Pull Model
Authoring Phase
(May include
imperative as well as
declarative code)

PS V1, V2,
V3

Staging Phase
- Fully decl...
Summary
• DSC provides a standards based configuration
management platform
• PowerShell provides seamless integration with...
@Ravikanth
Ravikanth@PowerShellMagazine.com
Upcoming SlideShare
Loading in …5
×

Configuration management comes to Windows

811 views
719 views

Published on

This was the slide deck presented at DevOps Days India, November 2013. This describes the newly introduced Windows OS feature called Desired State Configuration (DSC) in Windows Server 2012 R2.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
811
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Configuration management comes to Windows

  1. 1. Configuration Management comes to Windows Ravikanth Chaganti Dell MVP, Windows PowerShell Founder, PowerShell Magazine Lead, BITPro and PSBUG @Ravikanth Ravikanth@PowerShellMagazine.com
  2. 2. How many of you heard and/or used PowerShell?
  3. 3. What every CIO or IT administrator want? Continuous Service Availability Continuous Rapid Release Cycle Continuous Deployment
  4. 4. Desired State Configuration Enables you to ensure that the components of your data center have the correct configuration Allows “continuous deployment” and prevents “configuration drift” Uses language extensions and providers to enable declarative, autonomous and idempotent (repeatable) Deployment, Configuration and Conformance of standards-based managed elements
  5. 5. DSC - How do you get it? • Windows Server 2012 R2 • Windows 8.1 • Windows Management Framework 4.0 ▫ Windows Server 2012 ▫ Windows Server 2008 R2 ▫ Windows 7
  6. 6. DSC - Basics Configuration ArchiveDemo { Node SRV3-WS2012R2 { Archive ArchiveDemo { Path = "10.10.10.101BackupScripts.zip" DestinationPath = "C:Scripts" Ensure="Present" } } } • Can take parameters like a function ArchiveDemo • Each Configuration document gets converted to a MOF .PS1 • Uses PowerShell Remoting
  7. 7. DSC - Resources Archive Environment File Group Log Package Process Registry Role Script Service User … Of course, You can build your own resources
  8. 8. Demo DSC Resources
  9. 9. Writing Custom Resources • Create a MOF file describing the resource • Create a PowerShell Module (PSM1 & PSD1) ▫ ▫ ▫ ▫ Set-TargetResource Test-TargetResource Get-TargetResource Must be idempotent • Copy all files to C:Windowssystem32WindowsPowerShellv1.0 ModulesPSDesiredStateConfigurationPSProvide rs
  10. 10. Custom Resource MOF [version("1.0.0"), FriendlyName("HostsFile")] class HostsFile : MSFT_BaseResourceConfiguration { [Key] string hostName; [Key] string ipAddress; [write,ValueMap {"Present", "Absent"},Values{"Present", "Absent"}] string Ensure; }; HostsFile.Schema.Mof • [Key] for unique attributes; become mandatory • [Write] for attributes for which a value can be specified • [Read] for readonly attributes • ValueMap defines the possible values • Naming: classname.schema. mof
  11. 11. Custom Resource Module • Same parameters on ▫ Get-TargetResource  Must return hashtable of the configuration ▫ Set-TargetResource ▫ Test-TargetResource  Must return true or false • Module Manifest is required ▫ Use New-ModuleManifest
  12. 12. Resource Execution Flow Start Run TestTargetResource False Run SetTargetResource End True
  13. 13. Local Configuration Manager • Each computer with PS 4.0 runs a DSC Engine (as SYSTEM) • Responsible for calling the DSC resources • LCM properties can be updated to use pull model; of course, using DSC 
  14. 14. Configuration Delivery • Push ▫ Default delivery mechanism ▫ Start-DSCConfiguration • Pull ▫ DSC Service ▫ IIS Endpoint or SMB ▫ Requires  Windows Server 2102 or  Windows Server 2012 R2
  15. 15. Push Model Authoring Phase (May include imperative as well as declarative code) PS V1, V2, V3 PS V4*** Staging Phase - Fully declarative configuration representation using DMTF standard MOF instances - Configuration is calculated for all nodes Configuration Staging Area (Contains DSC data) 3rd party languages and tools *** When authoring in PowerShell, on top of PSV3 imperative features, PSV4 adds: • Declarative syntax extensions • Schema-driven Intellisense • Schema validation (early-binding) “Make it So” Phase (Declarative configuration is reified through imperative providers.) Local Configuration Store Parser and Dispatcher Imperative Providers Providers implement changes: • Monotonic • Imperative • Idempotent
  16. 16. Pull Model Authoring Phase (May include imperative as well as declarative code) PS V1, V2, V3 Staging Phase - Fully declarative configuration representation using DMTF standard MOF instances - Configuration is calculated for all nodes “Make it So” Phase (Declarative configuration is reified through imperative providers.) Local Configuration Store Pull Server PS V4*** (Contains DSC data and Modules) 3rd party languages and tools *** When authoring in PowerShell, on top of PSV3 imperative features, PSV4 adds: • Declarative syntax extensions • Schema-driven Intellisense • Schema validation (early-binding) Parser and Dispatcher Imperative Providers Providers implement changes: • Monotonic • Imperative • Idempotent
  17. 17. Summary • DSC provides a standards based configuration management platform • PowerShell provides seamless integration with Windows platform • End goal is to help manage heterogeneous platforms and the cloud.
  18. 18. @Ravikanth Ravikanth@PowerShellMagazine.com

×