CROSS-PLATFORM CONFIGURATION
MANAGEMENT WITH
DESIRED STATE CONFIGURATION
Ravikanth C
Windows PowerShell MVP
PowerShellMagazine.com
@ravikanth
AGENDA
• DSC PRIMER
• DEMO
DSC PRIMER
• Address challenges in
– Continuous Delivery and Integration
– Configuration Management
• Management Platform
– Available for Windows and Linux/Unix
• Provides
– Language Extensions
– Resources
– PowerShell Cmdlets
• Declarative Style (DSL)
• Push and Pull configuration delivery
DSC PRIMER
What about these and
many others?
DSC PRIMER
• Configuration Management as an API
• Write your own tools to
– Author
– Stage
– Push
– Monitor
• Or use 3rd-party tools such as ScriptRock
GaurdRail and so on!
DSC PRIMER
• Configuration is stored at:
– Windows: C:WindowsSystem32Configuration
– Linux: /opt/omi-1.0.8/etc/dsc/configuration
• Current.mof – Present configuration (N)
• Backup.mof – Copy of Current.mof
• Pending.mof – Configuration changes
pending
• Previous.mof – N-1 configuration
• MetaConfig.mof – LCM configuration
DSC PRIMER
• DSC logs provide insight into
configuration changes and issues
• Windows: Event Logs
– Applications and Services
Logs/Microsoft/Windows/Desired State
Configuration
• Linux: /opt/omi-1.0.8/var/log
DSC IN ACTION & DSC API
Demo
DSC PRIMER
• Custom resource authoring is easy!
– Heard of Modules?
• For Windows OS
– Script Modules
– Binary Modules in C#
– MI Provider (native code)
• For Linux OS
– MI Provider
BACKUP
DECLARATIVE SYNTAX
Configuration ArchiveDemo {
Node SRV3-WS2012R2 {
Archive ArchiveDemo {
Path = "10.10.10.101BackupScripts.zip"
DestinationPath = "C:Scripts"
Ensure="Present"
}
}
}
ArchiveDemo
.PS1
DSC ARCHITECTURE
LCM API
CIM Method PowerShell Cmdlet
SendConfigurationApply Start-DscConfiguration
SendConfiguration -
ApplyConfiguration -
GetConfiguration Get-DscConfiguration
Rollback Restore-DscConfiguration
TestConfiguration Test-DscConfiguration
StopConfiguration -
SendMetaConfigurationApply Set-DscLocalConfigurationManager
GetMetaConfiguration Get-DscLocalConfigurationManager
PerformRequiredConfigurationChecks -
Custom Resources
• Three Functions
– Get-TargetResource
– Set-TargetResource
– Test-TargetResource
Start
Test-
TargetResource
Set-
TargetResource
False
End
True

Cross platform configuration management using Desired State Configuration

  • 1.
    CROSS-PLATFORM CONFIGURATION MANAGEMENT WITH DESIREDSTATE CONFIGURATION Ravikanth C Windows PowerShell MVP PowerShellMagazine.com @ravikanth
  • 2.
  • 3.
    DSC PRIMER • Addresschallenges in – Continuous Delivery and Integration – Configuration Management • Management Platform – Available for Windows and Linux/Unix • Provides – Language Extensions – Resources – PowerShell Cmdlets • Declarative Style (DSL) • Push and Pull configuration delivery
  • 4.
    DSC PRIMER What aboutthese and many others?
  • 5.
    DSC PRIMER • ConfigurationManagement as an API • Write your own tools to – Author – Stage – Push – Monitor • Or use 3rd-party tools such as ScriptRock GaurdRail and so on!
  • 6.
    DSC PRIMER • Configurationis stored at: – Windows: C:WindowsSystem32Configuration – Linux: /opt/omi-1.0.8/etc/dsc/configuration • Current.mof – Present configuration (N) • Backup.mof – Copy of Current.mof • Pending.mof – Configuration changes pending • Previous.mof – N-1 configuration • MetaConfig.mof – LCM configuration
  • 7.
    DSC PRIMER • DSClogs provide insight into configuration changes and issues • Windows: Event Logs – Applications and Services Logs/Microsoft/Windows/Desired State Configuration • Linux: /opt/omi-1.0.8/var/log
  • 8.
    DSC IN ACTION& DSC API Demo
  • 9.
    DSC PRIMER • Customresource authoring is easy! – Heard of Modules? • For Windows OS – Script Modules – Binary Modules in C# – MI Provider (native code) • For Linux OS – MI Provider
  • 10.
  • 11.
    DECLARATIVE SYNTAX Configuration ArchiveDemo{ Node SRV3-WS2012R2 { Archive ArchiveDemo { Path = "10.10.10.101BackupScripts.zip" DestinationPath = "C:Scripts" Ensure="Present" } } } ArchiveDemo .PS1
  • 12.
  • 13.
    LCM API CIM MethodPowerShell Cmdlet SendConfigurationApply Start-DscConfiguration SendConfiguration - ApplyConfiguration - GetConfiguration Get-DscConfiguration Rollback Restore-DscConfiguration TestConfiguration Test-DscConfiguration StopConfiguration - SendMetaConfigurationApply Set-DscLocalConfigurationManager GetMetaConfiguration Get-DscLocalConfigurationManager PerformRequiredConfigurationChecks -
  • 14.
    Custom Resources • ThreeFunctions – Get-TargetResource – Set-TargetResource – Test-TargetResource Start Test- TargetResource Set- TargetResource False End True