Skip to content

Instantly share code, notes, and snippets.

@ncjohnson
Created September 24, 2016 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ncjohnson/a877e0d31b01dfc66f0c82690dbb4178 to your computer and use it in GitHub Desktop.
Save ncjohnson/a877e0d31b01dfc66f0c82690dbb4178 to your computer and use it in GitHub Desktop.
Chef + PowerShellDSC
How do Chef and DSC work together?
- dsc_script
- A resource that allows you to create a configuration and embed that inside of your Chef recipe.
- Point to external file with the DSC configuration
- Embed a snippet of DSC syntax
- WMF4+
- Creates a configuration function and applies it via the LCM
- Everything that you normally use in DSC is available
- If you have multiple scripts, then it can be a little slower.
- Set LCM to not allow reboot
- Set LCM to Apply only. (monitoring will slow things down. if it is checking something, will not allow a new configuration to be applied and will cause chef-client run to fail
- Synchronously parsing and getting verbose output and using that to determine what chef does
- dsc_resource
- WMF5 +
- The LCM refresh mode must be disabled
- Individually call test, set and get methods under your own control
- LCM = API you can call test and set methods individually
- Much better performance
- Cannot use composite resources with dsc_resource
- You cannot use dsc_script and dsc_resource on the same machine without changing the LCM state between them
What does Chef bring to the table
- Responsiveness - in DSC the only place you can do logic about state is inside that resource.
- Chef builds the resource collection actively every time it runs on that client, and take into account current state of the node
- Notifications - Resources can notify/ subscribe to each other to run conditionally. In DSC this requires a custom resource because you cannot conditionally run one resource in response to the state of another resource.
- Environmental Data - being able to leverage Ohai data and make decisions based on it using variables
- Roles - a bucket for a common configuration
- Environments - pin cookbook versions to environments
- Data bags - where to put arbitrary data to be used in your configuration
- Ecosystem
- Testing tools, cloud API wrappers
- Existing cookbooks with current enterprise use
- Reporting and analytics data and management dashboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment