DevOps and Chef improve your life


Published on

Quick intro to DevOps techniques and methodologies and configuration management with Chef

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

DevOps and Chef improve your life

  1. 1. Devops and Infrastructure Automation with Chef
  2. 2. DevOpsDev who? Ops what?Dont bother me dude
  3. 3. It works on my machine...Developers We need mongo 2.2.1 BTW the deployment is due tomorrow
  4. 4. Sysadmins We don’t support that versionThe architecture doesn’t match our network, deployment, or security model We weren’t consultedabout security / monitoring / backup / provisioning
  6. 6. Current situationThe damn developers are not aware aboutthe impact of his source code in theproduction systems.They have a optimized toolkit for developquicklyThey run the code locally in his laptop evenif there are testing/staging/integration envsto try code
  7. 7. The key for get business objectivesDevelopers contribute value to the businessimplementing functional requirementsSysadmins contribute value to the businessimplementing security, stability and performanceBoth objectives crush because new funcionalitiesinvolve assume risksSysadmins try to decrease risks avoiding changesand release deployments are delayed and finally a lotof changes are done simultaneously
  8. 8. Operations objective is not onlymaintain a safety, stable and fasterenvironmentAnother important objective is enablebusiness objectivesBusiness requires changes and changesare the root of the instability so..
  9. 9. RecommendationsImplication since first steps of development➔Configuration is code, separated of the application code➔Common and integrated tools between teams➔Abstract administration➔Continuous integration➔Infrastructure and provisioning automated➔Shared KPI➔
  10. 10. ToolsVersion management➔DNS➔Inventory➔Monitoring➔Reports➔Configuration management➔Incidents management➔Deployment➔
  11. 11. Automation• Infrastructure• Provisioning• Deployment
  12. 12. DevOpsCombined interest of developers and operations in➔ Processes➔ Communication➔ AutomationClose cooperation based on common tools
  13. 13. CommunicationConfidencePositive attitudeAvoid to blame others
  14. 14. ChefOpen Source Provisioning Tool➔ Configures your servers➔ Cookbooks & recipes➔ Ruby DSL
  15. 15. Chef Solo
  16. 16. Chef Server
  17. 17. Common TerminologyThe following are some Chef terms that will be helpful to know before weStart.Node: A managed machine. When the Chef client runs, it executes theconfiguration for a node.Client: An authorized user of the Chef API. In most cases, every machine youmanage will be represented by: a) a client for logging into the API and b) anode configuration to apply. Administrators and the web interface are alsoclients.Cookbook: A collection of attributes, recipes, custom resources, anddefinitions to configure a certain application or service. For instance you willfind shared cookbooks available on the web for NTP, Apache httpd, MySQL,nginx, and other common services.Recipe: A list of resources that should be applied to a node. Recipes arewritten in normal Ruby extended by the Chef resource domain-specificlanguage. This gives you the power of anything you can do in Ruby(conditionals, using gems, etc.) while not having to be verbose in managingthe resources that make up your configuration.
  18. 18. Chef componentsKnifeKnife is the tool you will use as a system administrator to interact withthe server most often, especially taking cookbooks and other customconfigurations and loading them into the server for distribution to clientsChef ClientThe Chef client runs on the servers you are managing. It gathersinformationabout itself using Ohai, synchronizes the cookbooks it needs from the Chefserver, compiles the collection of resources that make up the configuration,and then “converges” the resources it has compiled with the state of thecurrent machineWeb-UIChef includes a web interface that lets you browse cookbooks and browseandedit nodes, roles, and clients.Server/APIThe Chef server sits at the center of the system. The Chef server exposesa RESTful API, which is used by the other components in the system. Yourmanaged nodes, knife, and the web interface are all clients of the API..
  19. 19. Ohai Detects data about your local machine & OS➔ Kernel stats➔ Modules & drivers➔ Programming Languages➔ Users➔ Filesystems➔ Network configuration● Populates attributes and makes them available for Chef
  20. 20. Configuration● JSON: /etc/chef/solo.json Run Chef Solo
  21. 21. Resources ● The steps that make up a recipe● Implemented by providers, depending on your platform● (in this case apt-get, rpm, zypper or MacPorts)
  22. 22. ● Script Resource Supports bash, csh, Ruby, Python, and Perl
  23. 23. Deploying● Deploy resource● Compatible with Capistrano layout● Supports Capistrano hooks via deploy/hook_name.rb
  24. 24. Deploying● Available in all Resources● Common methods:action➔provider➔Supports➔ignore_failure➔not_if / only_if➔notifies➔subscribes➔
  25. 25. Notifications● Notifiy other resources to execute an action ● Default notification happens at the end of the Chef run,
  26. 26. RolesComposites of recipes and attributes➔➔ Nodes can have multiple roles
  27. 27. Role Definition● $ cat roles/webserver.rb
  28. 28. Chef Server Knife● CLI tool for Chef-Server:➔ List nodes, cookbooks & attributes➔ Assign roles➔ Upload new cookbooks
  29. 29. Two Phases of Chef1) CompileLoad all attributes & recipes and build list ofactions/dependenciesCompute attribute tree2) RunRandom Ruby Code runs hereActually execute the resources
  30. 30. Chef Experiences Great way to automate provisioning of servers➔Infrastructure as code➔Understandable by dev & ops➔ Easy to extend➔ Easy to integrate in managementframework➔(SSH, mcollective, Nanite, ..)➔Ignore Chef-Server when starting toplay with Chef(dev envs)
  31. 31. Devops Rocks!
  32. 32. Author● Juan Vicente Herrera Ruiz de Alejo●● @jvicenteherrera
  33. 33. References● duty-dev-ops● demonios-es-eso-de-devops-y-porquedebera- interesarme