Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Cookbook Reusability
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
someara
October 02, 2014
Technology
820
0
Share
Cookbook Reusability
Chef Summit 2014
someara
October 02, 2014
More Decks by someara
See All by someara
Docker Docker Docker Chef
someara
0
510
Hand Crafted Artisinal Chef Resources
someara
0
610
Configuration Management Camp 2015
someara
1
570
TDI with ChefDK 0.0.1
someara
2
890
Configuration Management 101 @ Scale12x
someara
2
910
Configuration Management 101
someara
3
800
Introduction to Chef - Scale 10x
someara
2
460
Introduction to Chef - NYLUG Jan 2012
someara
2
310
Introduction to Chef - LISA11
someara
10
6.2k
Other Decks in Technology
See All in Technology
論文紹介:Pixal3D (SIGGRAPH 2026)
tenten0727
0
560
TSKaigi 2026 - enumよ、さようなら
teamlab
PRO
1
160
なぜ、IAMロールのプリンシパルに*による部分マッチングが使えないのか? / 20260518-ssmjp-iam-role-principal
opelab
2
140
PdM・Eng・QAで進めるAI駆動開発の現在地/aidd-with-pdm-eng-qa
shota_kusaba
0
260
O'Reilly Infrastructure & Ops Superstream: Platform Engineering for Developers, Architects & the Rest of Us
syntasso
0
300
20260515 ID管理は会社を守る大切な砦!〜🔰情シス向け〜
oidfj
0
720
実践 TanStack Start ― 新規プロダクトを開発して確立した、サーバーとクライアント境界の設計パターン / Practical TanStack Start Server-Client Boundary Patterns
kaminashi
1
120
Claude Code / Codex / Kiro に AWS 権限を 渡すとき、何を設計すべきか
k_adachi_01
6
1.8k
AWSアップデートから考える継続的な運用改善
toru_kubota
2
310
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
100k
React Compiler導入から21ヶ月、いま始めるならこうやる
astatsuya
2
270
分断された OT と IT を繋ぐ架け橋 -Kubernetes が切り拓く 産業用組み込み製品の現在地 -
yudaiono
1
130
Featured
See All Featured
The untapped power of vector embeddings
frankvandijk
2
1.7k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
360
Skip the Path - Find Your Career Trail
mkilby
1
120
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
170
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
350
Between Models and Reality
mayunak
4
290
Reality Check: Gamification 10 Years Later
codingconduct
0
2.1k
Balancing Empowerment & Direction
lara
6
1.1k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
550
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
310
Abbi's Birthday
coloredviolet
2
7.6k
Technical Leadership for Architectural Decision Making
baasie
3
370
Transcript
Cookbook Reusability! Chef Community Summit 2014
Sean OMeara!
[email protected]
! @someara
whoami
A Year in Review
Diversification
7zip! apache2! ark! application*! couchdb! Imagemagick! java
logrotate! mercurial! munin! nagios! nginx! ntp! openvpn
pacman! postgresql! python! reprepro! rabbitmq! runit! supervisor
selinux! tmux! varnish ! wordpress!
Supermarket https://www.flickr.com/photos/mobilestreetlife/10885044043
• Escaped the tyranny of JIRA! • Moved to Github
Issues! • Automated CLA checking! • OSS Artifact Repository
Rewrites
2009 0.5.2 Chef Vagrant ChefSpec 0.1.0 0.0.2 Minitest-Chef Berkshelf Test
Kitchen 2010 0.9.0 2011 0.10.0 2012 10.12.0 1.0.0 0.2.0 1.0.0 0.7.0 1.0.0 2013 2014 1.0.0 2.0.0 1.0.0 2.0.0 1.4.0 11.0.0 12.0.0 1.6.5 3.0.0 3.0.0 1.2.2 ServerSpec ChefDK 0.0.1 2.0.0 0.2.2 TDI Capability 0.8.0
yum! yum-*! jenkins! mysql! httpd
The Evolution of a Chef Cookbook
Stage 1 - Paradise https://www.flickr.com/photos/nattu/1385100375/
None
test / repair test / repair test / repair
Easy to read Easy to grok Easy to test }
Stage 2 - if statements
logic compiled into resource collection
Resource DSL } Just Ruby }
Resource DSL } Just Ruby } }Chef
Stage 3 - Crazytown https://www.flickr.com/photos/kwl/4595324641
None
wat
Why?
Reusable is useful
Cross-platform is useful
We desire useful things
Platform idioms are hard
Keeping the Dream Alive https://www.flickr.com/photos/kalexanderson/7014655351/
Most people just write their own cookbooks from scratch
I really really really want reusable cross-platform cookbooks
Lessons Learned
Attributes are routinely abused https://www.flickr.com/photos/jabberwocky381/2828863789
None
Attributes are an interface
Attributes are tunable knobs
None
You probably just want a variable
None
Or even a method
None
Using an attribute to track state during a Chef run
causes tears and sorrow
Prefer resource parameters
None
None
Primitives are more useful than opinionated policy
“They’re Just Resources”! ! LWRP is Googleable
Zoom out a level! ! Think about services and runtimes,
not files and processes
Singleton resources are good but confusing. Possibly even dangerous.! !
Multiple instance support is better! ! Cross-platform resources are best
None
BDD / TDD yields high quality cookbooks https://www.flickr.com/photos/glenirah/4376553184
Test Kitchen! ServerSpec / Minitest / Bats! ChefSpec
2009 0.5.2 Chef Vagrant ChefSpec 0.1.0 0.0.2 Minitest-Chef Berkshelf Test
Kitchen 2010 0.9.0 2011 0.10.0 2012 10.12.0 1.0.0 0.2.0 1.0.0 0.7.0 1.0.0 2013 2014 1.0.0 2.0.0 1.0.0 2.0.0 1.4.0 11.0.0 12.0.0 1.6.5 3.0.0 3.0.0 1.2.2 ServerSpec ChefDK 0.0.1 2.0.0 0.2.2 This Slide Again 0.8.0
Full test coverage is tedious
Full test coverage is totally worth it
Let users bring their own configurations
It is better to add to a resource_collection than to
monkey patch it
Configuration files are the brains of a service
Manage minimal configuration to get a service running
Offload further configuration to the user
conf.d is your friend
Hide everything else inside a resource
Add resource parameters when appropriate
None
None
Cross-platform cookbooks are hard https://www.flickr.com/photos/glenirah/4376553184
Cross-platform resources are even harder
They can be done!
Create a resource
None
Create a provider
None
Subclass platform providers
None
None
None
None
None
Set provider default for platforms
None
Do Repeat Yourself
Some resources are often the duplicated across providers
That’s fine. It’s the pattern as a whole that’s important
Maximize for grokability
People will be reading your code for the first time
during operations work
Init systems are annoying
Using a service resource usually requires file or template resources
in addition to service[thingd]
Debconf! Docker! LaunchD! Runit! SMF! Simple! SystemD! Sysvinit! Upstart! Windows
Services
Subclassing is awesome
None
Customize before recipe compilation
Going Forward
Cookbooks that ship resource primitives
More examples to copy
More breaking backwards compatibility (sorry)
Providers implemented with Docker containers (why not?)
chef-metal
Tell me what you think
Please don’t hurt me =)
None