under the covers -- chef in 20 minutes or less
DESCRIPTION
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.TRANSCRIPT
Under The Covers - Chef in 20 Minutes
www.opscode.com
• You have a Cloud
• Now what?
http://www.flickr.com/photos/ian_munroe/4758240536/
Congratulations!!!
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
Chef can help with that
• knife ec2 server create
• knife rackspace server create
• knife terremark server create
• knife gandi server create
• knife bluebox server create
• knife brightbox server create
• knife vsphere server create
• knife openstack server create
• knife eucalyptus server create
http://www.flickr.com/photos/kyz/3122499444/
But then what?
http://www.flickr.com/photos/doctorow/2698336843
You need to configure them
Give me some operating system and put it on the network
Chef can help with that too
• That’s what we do.
Golden Images are not the answer
http://www.flickr.com/photos/bankofengland/5762003476
• Gold is heavy
• Hard to transport
• Hard to mold
• Easy to lose configuration detail
Chef is Infrastructure as Code
http://www.flickr.com/photos/louisb/4555295187/
• Programmatically provision and configure
• Treat like any other code base
• Reconstruct operations from code repository, data backup, and bare metal resources.
Chef configures Resources
http://www.flickr.com/photos/stevekeys/3123167585/
• Nodes
• Networking
• Files
• Directories
• Symlinks
• Mounts
• Routes
• Users and Groups
• Tasks
• Packages
• Software
• Services
• Configurations
• Stuff
With declarative interfaces
• Define policy
• Say what, not how
• Pull not Push
http://www.flickr.com/photos/bixentro/2591838509/
package "ntp" do action :installend
service "ntpd" do action [:enable,:start]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
That looks like this
package "net-snmp" do action :installend
service "snmpd" do action [:enable,:start]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
That looks like this
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/
Apply Run Lists to Nodes
ServerServerServerServer
chef-server
API chef-clientOhai!
Give me recipe[ntp::client]
node
ntp
client.rb
executed in order!
ServerServerServerServer
chef-server
API chef-clientOhai!
Give me “ntp::client”,
“openssh::server”
node
ntp
client.rb
openssh
server.rb
Build up reusable code
executed in order!
Apply them in order
ServerServerServerServer
chef-server
API chef-client
Ohai! Give me
“recipe[ntp::client]”, “recipe[openssh::server]”,
“recipe[apache]”,“recipe[php]”node
ntp
client.rb
openssh
server.rb
apache
default.rb
php
default.rb
executed in order!
Roles
Role
RecipeRecipeRecipe
Role
Role
RecipeRecipeRecipeRole
Recipe
ServerServerServerServer
chef-server
API
Knife
ServerServerServerServer
chef-server
API chef-client Ohai! Give me
“role[base]”,“role[webserver]”
node
ntp
client.rb
openssh
server.rb
apache
default.rb
php
default.rb
Roles
ServerServerServerServer
chef-server
APIchef-client
“role[webserver]”
node
ntp
client.rb
openssh
server.rb
apache
default.rb
php
default.rb
Roles
chef-client
“role[database]”node
ntp
client.rb
openssh
server.rb
mysql
server.rb
Recipes can search chef-sever
• IP addresses
• Hostnames
• FQDNs
• Search for nodes with Roles
• Find configuration data
http://www.flickr.com/photos/fotos_medem/3399096196/
App LBs
App Servers
App DB Cache
App DBs
And stitch together Infrastructures
App LBs
App Servers
App DB Cache
App DBs
Floating IP?
Your Infrastructure is a snow flake
And it Evolves
App LBs
App Servers
NoSQL
DB slaves
Cache
DB Cache
DBs
Quickly
DC1
DC3
DC2
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/
And manage it simply
http://www.flickr.com/photos/helico/404640681/
• Automatically reconfigure everything
• Load balancers
• Metrics collection systems
• Monitoring systems
• Cloud migrations become trivial