Learn how to automate your infrastructure to make more time for fun things. In this rapid fire intro to Chef, an open source provisioning and automation platform, we'll touch on the strengths of it's flexible architecture as well as showing some concrete and simple starting points on your path to become an executive chef.
3. Congratulations!!!
• You have a
Cloud
• Now what?
http://www.flickr.com/photos/ian_munroe/4758240536/
4. APIs are awesome
• You can provision
compute resources in
seconds
• You can provision
storage resources in
seconds
• That’s cool.
http://www.flickr.com/photos/jdhancock/3634246981/
Give me some operating system and put it on the network
5. Chef can help with that
• knife ec2 server • knife brightbox
create server create
• knife rackspace • knife vsphere
server create server create
• knife terremark • knife openstack
server create server create
• knife gandi • knife eucalyptus
server create server create
• knife bluebox
server create
http://www.flickr.com/photos/kyz/3122499444/
9. Golden Images are not the answer
• Gold is heavy
• Hard to transport
• Hard to mold
• Easy to lose
configuration detail
http://www.flickr.com/photos/bankofengland/5762003476
10. Chef is Infrastructure as Code
• Programmatically
provision and configure
• Treat like any other code
base
• Reconstruct operations
from code repository, data
backup, and bare metal
resources.
http://www.flickr.com/photos/louisb/4555295187/
12. With declarative interfaces
• Define policy
• Say what, not how
• Pull not Push
http://www.flickr.com/photos/bixentro/2591838509/
13. That looks like this
package "ntp" do
action :install
end
template "/etc/ntp.conf" do
source "ntp.conf.erb"
owner "root"
group "root"
mode 0644
action :create
variables( :ntp_server => “time.example.com”)
notifies :restart, “service[ntpd]”
end
service "ntpd" do
action [:enable,:start]
end
14. That looks like this
package "net-snmp" do
action :install
end
template "/etc/snmpd.conf" do
source "snmpd.conf.erb"
owner "root"
group "root"
mode 0644
action :create
variables( :community_string => “not_public”)
notifies :restart, “service[snmpd]”
end
service "snmpd" do
action [:enable,:start]
end
15. Creating recipes and cookbooks
• Recipes are collections of
Resources
• Cookbooks contain recipes,
Templates, files, custom
resources, etc
• Code re-use and modularity
http://www.flickr.com/photos/shutterhacks/4474421855/
16. Apply Run Lists to Nodes
Server
Server
chef-server
Server
Server
Ohai!
API chef-client
Give me
recipe[ntp::client]
ntp
node
client.rb
executed in order!
17. Build up reusable code
Server
Server
chef-server
Server
Server
Ohai!
chef-client
API Give me
“ntp::client”,
ntp “openssh::server”
openssh
node
client.rb
server.rb
executed in order!
18. Apply them in order
Server
Server
chef-server
Server
Server
Ohai!
chef-client Give me
API
“recipe[ntp::client]”,
ntp “recipe[openssh::server]”,
“recipe[apache]”,
openssh
node “recipe[php]”
client.rb apache
server.rb php
default.rb
default.rb
executed in order!
19. Roles
Server
Server
chef-server
Server
Server
Role Recipe
API
Role
Role Recipe
Role Recipe
Recipe
Knife
Recipe
Recipe
Recipe
20. Roles
Server
Server
chef-server
Server
Server
chef-client Ohai!
API
Give me
ntp “role[base]”,
“role[webserver]”
openssh
node
client.rb apache
server.rb php
default.rb
default.rb
21. Roles
Server
Server
chef-server
Server
Server
ntp
openssh
chef-client
API client.rb apache
php
server.rb “role[webserver]”
default.rb
ntp default.rb node
openssh
chef-client
client.rb mysql
server.rb
server.rb
“role[database]”
node
22. Recipes can search chef-sever
• Search for nodes with
Roles
• Find configuration data
• IP addresses
• Hostnames
• FQDNs
http://www.flickr.com/photos/fotos_medem/3399096196/
23. And stitch together Infrastructures
App LBs
App Servers
App DB Cache
App DBs
24. Your Infrastructure is a snow flake
App LBs
App Servers
App DB Cache
Floating IP?
App DBs
25. And it Evolves
App LBs
Cache
App Servers
NoSQL DB Cache
DB slaves
DBs
27. Build anything
• Simple internal applications
• Complex internal applications
• Workstations
• Hadoop clusters
• IaaS applications
• PaaS applications
• SaaS applications
• Storage systems
• You name it
http://www.flickr.com/photos/hyku/245010680/
28. And manage it simply
• Automatically reconfigure
everything
• Load balancers
• Metrics collection
systems
• Monitoring systems
• Cloud migrations
become trivial
http://www.flickr.com/photos/helico/404640681/
29. Questions?
sarah.novotny@gmail.com
www.opscode.com
slides and original talk concept - Sean O’Meara