Chef Reusability!Config Management Camp!
Ghent, Belgium!February 2015
Sean [email protected]!
@someara
Things that are true
New Chef users expect community cookbooks to just work
Especially the Chef maintained cookbooks
This is not the current state of things
This leads to sadness
We must repair it
People copy patterns
The status quo cannot be allowed to continue
Common pain points
https://www.flickr.com/photos/kwl/4595324641
Platform and version support
No standard interface
Compilation phase work
Needing chef-rewind
Attributes and precedence
Pattern proliferation
The path out of the darkness
https://www.flickr.com/photos/71267357@N06/15864687537
Change how cookbooks are written
systems
beliefs! behaviors
Standardize interfaces
Eliminate the pain points
Focus on resources
Make it super easy!to write resources
Ship resources for ALL THE THINGS
Copy better patterns
Make it fucking delightful
Simple design patterns
https://www.flickr.com/photos/pollock/4172865252
You just separated data from code
You also just built an interface
Complex design patterns
https://www.flickr.com/photos/alanosaur/6417040565
This is where things get weird
amazon debian-6 debian-7 ubuntu-10.04 ubuntu-12.04 ubuntu-14.04 centos-5 centos-6 centos-7 freebsd-9 freebsd-10
Debconf!Docker!LaunchD!Runit!SMF!Simple!SystemD!Sysvinit!Upstart!Windows Services
There is a large amount of variation between software versions
There is an insane amount variation across platforms
These differences need to be handled somewhere
Early techniques did everything in the recipe
data
resource pattern
Later techniques focused on isolation
Resource pattern isolation
private recipes by convention
Resource data isolation
We now have decision logic in our interface
Default values often need to be computed
Doing this in the interface leads to sorrow
We need a better way
Consumption Patterns
https://www.flickr.com/photos/ektogamat/2578779839
Why resources are best
https://www.flickr.com/photos/cross_stitch_ninja/4932950637
node attributes roles environments databags are nice to haves
They drive data about resources
Resources are fundamental
Resources are strongly scoped
Resources have a standardized interface
Resources have types, names, and parameters
Resources have identities
Resource can see each other
Promise to listen
Resource behave the same across platforms
Resource can have multiple providers
Writing simple resources
</switches github>
Writing complex resources
</switches github>