DevOps as a buzzword has had a lot of attention recently. This presentation is my take on the origins and essence of the matter, as well as an introduction to how Chef, the open source configuration management software, can help to solve one of the problems an Operations team faces as it moves towards the DevOps goals.
14. What is DevOps?
They are making a play for our jobs
What is DevOps NOT?
Friday 16 March 12
15. Devs want root
What is DevOps?
They are making a play for our jobs
What is DevOps NOT?
Friday 16 March 12
16. DevOps is not a job title, it’s a philosophy
Devs want root
What is DevOps?
They are making a play for our jobs
What is DevOps NOT?
Friday 16 March 12
17. DevOps is not a job title, it’s a philosophy
Devs want root
What is DevOps?
They are making a play for our jobs
What is DevOps NOT?
So many words
Friday 16 March 12
21. DevOps, for me:
Testing
Monitoring
Automation
Friday 16 March 12
22. DevOps, for me:
Testing
Monitoring
Automation
Friday 16 March 12
23. DevOps, for me:
Testing Don’t release broken things
Monitoring Know when things break
Automation Replace/fix broken things instantly
Friday 16 March 12
42. SERVER
chef-client on node
use knife to push retrieves
config to server configuration
from server
use knife to query and
CLIENT CLIENT
ssh to clients
(workstation) (server/node)
Friday 16 March 12
51. apache_modules = ['wsgi', 'ssl',
'auth_tkt', 'proxy_http',
'headers', 'rewrite', 'status']
apache_modules.each do |mod|
apache_module mod do
enable true
notifies :restart,
"service[apache2]"
end
end
Friday 16 March 12
52. apache_modules = ['wsgi', 'ssl',
'auth_tkt', 'proxy_http',
'headers', 'rewrite', 'status']
apache_modules.each do |mod|
apache_module mod do
enable true
notifies :restart,
"service[apache2]"
end
end
Friday 16 March 12
53. package "apache2" do
case node[:platform]
when "centos","redhat","fedora","suse"
package_name "httpd"
when "debian","ubuntu"
package_name "apache2-mpm-prefork"
end
action :install
end
Friday 16 March 12
54. package "apache2" do
case node[:platform]
when "centos","redhat","fedora","suse"
package_name "httpd"
when "debian","ubuntu"
package_name "apache2-mpm-prefork"
end
action :install
end
Friday 16 March 12
55. Chef/nodes/web1.json
Chef/roles/web.rb
Chef/cookbooks/apache/
recipes/default.rb
attributes/default.rb
Friday 16 March 12
64. class Chef
class Recipe
def apache_ports(&block)
@node[:apache][:vhosts].each do |vh|
vh[:ports].each do |p|
block.call(p)
end
end
end
end
end
Friday 16 March 12
65. apache_ports do |p|
firewall_port p do
action :open
end
end
Friday 16 March 12
66. apache_ports do |p|
firewall_port p do
action :open
end
end
Friday 16 March 12
67. define :firewall_port, :action => :open do
if not params.has_key?(:port)
params[:port] = params[:name]
end
if params[:action] == :open
execute "open #{params[:port]}" do
command "iptables -A INPUT --destination-port
#{params[:port]} -j ACCEPT"
end
else
execute "close #{params[:port]}" do
command "iptables -A INPUT --destination-port
#{params[:port]} -j DROP"
end
end
end
Friday 16 March 12
68. Providers
package "apache2" do
action :install
end apt-get install
yum install
node[:platform]
brew install
Friday 16 March 12
69. "#{File.expand_path(
Chef::Config[:file_cache_path]
)}/handlers/yola.rb"
Friday 16 March 12
70. "#{File.expand_path(
Chef::Config[:file_cache_path]
)}/handlers/yola.rb"
class YolaHandler < Chef::Handler
def report()
run_status.updated_resources.each do |r|
campfire_speak(r.to_s)
end
end
end
Friday 16 March 12
71. "#{File.expand_path(
Chef::Config[:file_cache_path]
)}/handlers/yola.rb"
class YolaHandler < Chef::Handler
def report()
run_status.updated_resources.each do |r|
campfire_speak(r.to_s)
end
end
end
Friday 16 March 12
80. Integration
configuration data vs configuration logic
Friday 16 March 12
81. Integration
configuration vs configuration logic
data
Friday 16 March 12
82. Integration
configuration vs configuration logic
data
Ohai Collects infrastructure data
Stored and indexed in NoSQL
Search and use
Friday 16 March 12
83. (A side note on) Attributes
default
normal
override
automatic
Friday 16 March 12
84. (A side note on) Attributes
default cookbooks, data bags
normal node definitions
override for special cases
automatic ohai
Friday 16 March 12
85. (Back to) Integration
search(:node, 'role:webbackend') do |wb|
haproxy_backend "#{wb[:apache][:port]}" do
action :create
end
end
Systems auto-discover each other
Configuration is responsive to changes
Friday 16 March 12
86. Integration
search(:node, 'role:webbackend') do |wb|
haproxy_backend "#{wb[:apache][:port]}" do
action :create
end
end
Systems auto-discover each other
Configuration is responsive to changes
So you don’t have to be!
Friday 16 March 12