Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Chef and PowerShell Desired State Configuration September 4th, 2014 ! Stephen Nelson-Smith [email protected] @LordCope

Slide 3

Slide 3 text

Prologue: ! Configuration management maturity is a prerequisite for organisational effectiveness

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Effectiveness: The ability to achieve chosen and set goals

Slide 6

Slide 6 text

IT Effectiveness: Perceptiom Effectiveness

Slide 7

Slide 7 text

IT Effectiveness: Perceptiom Effectiveness

Slide 8

Slide 8 text

IT Effectiveness: Perceptiom Effectiveness

Slide 9

Slide 9 text

IT Effectiveness: Perception Effectiveness

Slide 10

Slide 10 text

IT Effectiveness: Reality Effectiveness

Slide 11

Slide 11 text

Config Management Maturity Model Level 1 Hand-crafted ! snowflakes No shared knowledge

Slide 12

Slide 12 text

Config Management Maturity Model Level 1 Level 2 Hand-crafted ! snowflakes No shared knowledge Runbooks and Wikis Scripts Golden Images

Slide 13

Slide 13 text

Config Management Maturity Model Level 1 Level 2 Level 3 Hand-crafted ! snowflakes No shared knowledge Runbooks and Wikis Scripts Golden Images First / Second! Generation! Configuration! Management Tools

Slide 14

Slide 14 text

Config Management Maturity Model Level 1 Level 2 Level 3 Level 4 Hand-crafted ! snowflakes No shared knowledge Runbooks and Wikis Scripts Golden Images First / Second! Generation! Configuration! Management Tools Third / Fourth! Generation! Configuration! Management Tools

Slide 15

Slide 15 text

Config Management Maturity Model Level 1 Level 2 Level 3 Level 4 Level 5 Hand-crafted ! snowflakes No shared knowledge Runbooks and Wikis Scripts Golden Images First / Second! Generation! Configuration! Management Tools Third / Fourth! Generation! Configuration! Management Tools Third / Fourth! Generation! Configuration! Management Tools Orchestration Audit / Reporting Analytics

Slide 16

Slide 16 text

Effectiveness % Organizations Level 1 Level 2 Level 3 Level 4 Level 5

Slide 17

Slide 17 text

Microsoft is behind the curve… …but closing fast!

Slide 18

Slide 18 text

PowerShell History Early 1990s 1998 2002 2005 2006 2009 2014 2013 2012 COMMAND.COM! BATCH FILES WINDOWS SCRIPT HOST MONAD IN! DEVELOPMENT MONAD BETA! RELEASE POWERSHELL POWERSHELL 2.0 POWERSHELL! 3.0 POWERSHELL! 4.0! ! DESIRED STATE CONFIG POWERSHELL! 5.0 Level 3 / 4 Level 2

Slide 19

Slide 19 text

The Holy Trinity of Config Management Package File Service

Slide 20

Slide 20 text

The Holy Trinity of Config Management Package File Service …isn’t sufficient for full Windows automation

Slide 21

Slide 21 text

Assertion: ! Chef + PowerShell DSC = Level 5

Slide 22

Slide 22 text

Desired State

Slide 23

Slide 23 text

Desired State Configuration • Extensions to PowerShell 4.0 • Installed by default on Windows® 8.1 and Windows Server 2012 R2 • Windows 7 with SP1, or Windows Server 2008 R2 via Windows Management Framework 4.0

Slide 24

Slide 24 text

Desired State Configuration • Declarative interface to Windows automation • Enables self-provisioning (bootstrap to desired state) • Enables self-remediation (converges to desired state) • Has a resource/provider model • 12 resources out of the box

Slide 25

Slide 25 text

Out of the box…

Slide 26

Slide 26 text

How DSC Works • PowerShell 4 provides a DSL for generating a document (MOF) consumed by PowerShell module or WMI (Windows Management Infrastructure) resource • Machines may converge manually by running Start-DscConfiguration cmdlet • Systems under management run Local Configuration Manager • Support push and pull model • Systems remain convergent by running Test- DscConfiguration via CIM (Common Information Model) session

Slide 27

Slide 27 text

DSC Resource Kit • 6 releases since Boxing Day last year • Over 80 resources: ! ! • Highlights: • xAzure • xActiveDirectory • xFailoverCluster • xMySQL • xSmbShare • xWindowsUpdate

Slide 28

Slide 28 text

DSC Vision • Create an open ecosystem to enable 3rd party tools to automate Windows systems • Extend DSC concept to all devices in the data centre via open standards (Linux, Switches) • Make DSC a standard criteria for all Microsoft products

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

Chef • Automation framework • Declarative Ruby DSL for heterogenous system automation • Convergent infrastructure model • Server-based or standalone • Push or pull • Reporting, Search, Inventory, Analytics • Thriving unit and integration testing ecosystem • Cloud / Virtualization integration • Orchestration capabilities

Slide 31

Slide 31 text

Chef and Windows History May 2011 October 2011 December 2011 February 2012 August 2013 July 2014 ~ September 2014 KNIFE WINDOWS! PLUGIN POWERSHELL! IIS! SQL SERVER! WINDOWS! COOKBOOKS CHEF CLIENT! MSI REGISTRY_KEY! IN CORE CHEF POWERSHELL ! & ! BATCH SCRIPT IN CORE CHEF CHEF-CLIENT WINDOWS! SERVICE DSC PREVIEW! OPEN SOURCED DSC_SCRIPT! RESOURCE! IN CORE CHEF DESIRED STATE! SUPPORT! ANNOUNCED! (2014 DELIVERY)

Slide 32

Slide 32 text

Chef + DSC • PowerShell resource already exists • Two new resources: dsc_resource and dsc_script • Native Chef resource maps onto DSC resources • Embeddable of PowerShell DSC resources • Integrated reporting, analytics, audit • Technology provided via preview cookbook • Phase 1 integration (dsc_script) Functionality will ship in Chef 12, very soon • Phase 2 integration (dsc_resource) afterwards

Slide 33

Slide 33 text

dsc_resource • Provides an analogue to the DSC DSL

Slide 34

Slide 34 text

How to build the resource ! • Explore available DSC resources: ! ! • Examine the properties of the resource:

Slide 35

Slide 35 text

How to build the resource • Set the resource_name attribute to the name of the resource as a symbol, i.e. WindowsFeature in DSC becomes :windowsfeature. Case doesn’t matter. • For each property in the DSC resource for which you want to declare a desired value, use the syntax: property :property_name, value ! ! !

Slide 36

Slide 36 text

Side by Side

Slide 37

Slide 37 text

dsc_script • Formerly dsc_configuration • In Chef 12, very soon • Embed dsc code directly • No translation from Chef DSL into DSC resources

Slide 38

Slide 38 text

Chef + DSC Demo

Slide 39

Slide 39 text

The Future (Chef) • More resources moving into core Chef • Package, Reboot, Feature • dsc_resource in core Chef • Easy WinRM setup & bootstrap • New cookbooks: AD, WSUS, Group Policy

Slide 40

Slide 40 text

The Future (Microsoft) • DSC in Common Engineering Criteria • All product teams will support DSC and produce resources • Activity around OMI (Open Management Infrastructure) • Activitity around DAL (Datacentre Astraction Layer) • DSC on Linux • DSC for network switches • WMF 5.0 (OneGet, PowerShellGet, Network Switch cmdlets)

Slide 41

Slide 41 text

Getting to Maturity • You (probably) need both • Chef alone isn’t really sufficient • DSC provides an ecosystem and standard for automation and configuration • The Chef ecosystem adds testing, reporting/analytics • Chef + DSC = Win

Slide 42

Slide 42 text

Next Actions • Install ChefDK • Clone the DSC cookbook • Get the latest resource kit • Play with some DSC resources • Contribute to the RFC • Hang out in freenode #chef and #chef-hacking

Slide 43

Slide 43 text

Further Reading (Chef) https://github.com/opscode-cookbooks/dsc https://supermarket.getchef.com/cookbooks/dsc http://stevenmurawski.com/powershell/2014/9/why-chef-revisited http://www.getchef.com/blog/2014/07/24/getting-ready-for-chef- powershell-dsc/ https://github.com/opscode/chef-rfc/pull/29 https://downloads.getchef.com/chef-dk/

Slide 44

Slide 44 text

Further Reading (Microsoft) http://technet.microsoft.com/en-us/library/dn249912.aspx http://www.microsoft.com/en-us/download/details.aspx?id=42936 http://gallery.technet.microsoft.com/DSC-Resource-Kit-All-c449312d http://www.microsoft.com/en-us/download/details.aspx?id=42936 http://technet.microsoft.com/en-us/cloud/dal.aspx http://blogs.msdn.com/b/powershell/archive/2012/07/02/omi-open- management-infrastructure-to-bring-the-power-of-powershell-and-standards-to- devices-in-your-datacenter.aspx http://blogs.msdn.com/b/powershell/archive/2014/05/19/announcing-windows- powershell-desired-state-configuration-for-linux.aspx