Slide 1

Slide 1 text

Configuration Management comes to Windows Ravikanth Chaganti Dell MVP, Windows PowerShell Founder, PowerShell Magazine Lead, BITPro and PSBUG @Ravikanth [email protected]

Slide 2

Slide 2 text

How many of you heard and/or used PowerShell?

Slide 3

Slide 3 text

What every CIO or IT administrator want? Continuous Service Availability Continuous Rapid Release Cycle Continuous Deployment

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

DSC - Basics Configuration ArchiveDemo { Node SRV3-WS2012R2 { Archive ArchiveDemo { Path = "\\10.10.10.101\Backup\Scripts.zip" DestinationPath = "C:\Scripts" Ensure="Present" } } } ArchiveDemo .PS1 • Can take parameters like a function • Uses PowerShell Remoting • Each Configuration document gets converted to a MOF

Slide 7

Slide 7 text

DSC - Resources Archive Environment File Group Log Package Process Registry Role Script Service User … Of course, You can build your own resources

Slide 8

Slide 8 text

Demo DSC Resources

Slide 9

Slide 9 text

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:\Windows\system32\WindowsPowerShell\v1.0\ Modules\PSDesiredStateConfiguration\PSProvide rs

Slide 10

Slide 10 text

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; }; • [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 HostsFile.Schema.Mof

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

Resource Execution Flow Start Run Test- TargetResource Run Set- TargetResource False End True

Slide 13

Slide 13 text

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 

Slide 14

Slide 14 text

Configuration Delivery • Push ▫ Default delivery mechanism ▫ Start-DSCConfiguration • Pull ▫ DSC Service ▫ IIS Endpoint or SMB ▫ Requires  Windows Server 2102 or  Windows Server 2012 R2

Slide 15

Slide 15 text

Push Model Configuration Staging Area (Contains DSC data) 3rd party languages and tools Authoring Phase (May include imperative as well as declarative code) Staging Phase - Fully declarative configuration representation using DMTF standard MOF instances - Configuration is calculated for all nodes PS V1, V2, V3 PS V4*** “Make it So” Phase (Declarative configuration is reified through imperative providers.) Parser and Dispatcher Imperative Providers *** When authoring in PowerShell, on top of PSV3 imperative features, PSV4 adds: • Declarative syntax extensions • Schema-driven Intellisense • Schema validation (early-binding) Providers implement changes: • Monotonic • Imperative • Idempotent Local Configuration Store

Slide 16

Slide 16 text

Pull Model Pull Server (Contains DSC data and Modules) Authoring Phase (May include imperative as well as declarative code) 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.) Parser and Dispatcher Imperative Providers *** When authoring in PowerShell, on top of PSV3 imperative features, PSV4 adds: • Declarative syntax extensions • Schema-driven Intellisense • Schema validation (early-binding) Providers implement changes: • Monotonic • Imperative • Idempotent Local Configuration Store 3rd party languages and tools PS V1, V2, V3 PS V4***

Slide 17

Slide 17 text

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.

Slide 18

Slide 18 text

@Ravikanth [email protected]