Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Automate your Infrastructure with Chef

Automate your Infrastructure with Chef

Talk given at ConFoo 2013 on February 28th, 2013.

Christian Joudrey

February 28, 2013
Tweet

More Decks by Christian Joudrey

Other Decks in Programming

Transcript

  1. c #

  2. # d # d c # # # # #

    d in minutes
  3. instead of $ ssh root@app1 Last login: Thu Feb 28

    ... # apt-get install nginx ... # vim /etc/nginx/nginx.conf ... # apt-get install ruby ...
  4. # node # node # node # chef server (server1

    to server3.example.com) (chef.example.com) knife ! (local machine)
  5. # node # node # node # chef server (server1

    to server3.example.com) (chef.example.com) knife ! (local machine)
  6. # node # node # node # chef server (server1

    to server3.example.com) (chef.example.com) knife ! (local machine)
  7. # node # node # node # chef server chef-client

    (server1 to server3.example.com) knife ! (local machine)
  8. #

  9. #

  10. # node # node # node # chef server (server1

    to server3.example.com) (chef.example.com) knife ! (local machine)
  11. cookbooks/nginx/recipes/default.rb package "nginx" service "nginx" do supports :status => true,

    :restart => true, :reload => true action [:enable, :start] end
  12. !

  13. #

  14. #

  15. cookbooks/nginx/recipes/default.rb package "nginx" service "nginx" do supports :status => true,

    :restart => true, :reload => true action [:enable, :start] end template "/etc/nginx/nginx.conf" do source "nginx.conf.erb" notifies :reload, "service[nginx]" end
  16. cookbooks/nginx/recipes/default.rb package "nginx" service "nginx" do supports :status => true,

    :restart => true, :reload => true action [:enable, :start] end template "/etc/nginx/nginx.conf" do source "nginx.conf.erb" notifies :reload, "service[nginx]" end
  17. cookbooks/nginx/recipes/default.rb package "nginx" service "nginx" do supports :status => true,

    :restart => true, :reload => true action [:enable, :start] end template "/etc/nginx/nginx.conf" do source "nginx.conf.erb" notifies :reload, "service[nginx]" end
  18. cookbooks/nginx/recipes/default.rb package "nginx" service "nginx" do supports :status => true,

    :restart => true, :reload => true action [:enable, :start] end template "/etc/nginx/nginx.conf" do source "nginx.conf.erb" notifies :reload, "service[nginx]" end
  19. #

  20. #

  21. #

  22. #

  23. #

  24. #

  25. 2

  26. backend app balance roundrobin server app1 10.10.0.1 check port 80

    server app2 10.10.0.2 check port 80 server app3 10.10.0.3 check port 80
  27. backend www balance roundrobin <% @nodes.each do |n| %> server

    <%= n[:hostname] %> <%= n[:ipaddress] %> check port <% end %>