Automation of SysAdmin
using Chef
Senior Technical Specialist
Technical Support Services – Computing Platforms
University ...
Automation of SysAdmin using Chef
Components
Automation of SysAdmin using Chef
Components
• Chef-Server
• Roles
• Environments
• Chef-Client (node)
• Knife
• Cookbooks...
Recipes & Cookbooks?
Automation of SysAdmin using Chef
Recipes & Cookbooks?
What are they?
Where do I get them?
How can I customize them?
Struc...
Automation of SysAdmin using Chef
What are they?
A recipe is a list of instructions on how to install and configure a spec...
Automation of SysAdmin using Chef
Where do I get them?
Where do you usually get your ingredients from, the supermarket of ...
Automation of SysAdmin using Chef
How can I customize them?
• Fork them on Github
• Include them into you own recipe (List...
Automation of SysAdmin using Chef
Structure
-rw-r--r-- 1 501 20 142 Apr 22 15:01 Berksfile
-rw------- 1 501 20 311 May 21 ...
Abstraction is Key
Automation of SysAdmin using Chef
Abstraction
package “nginx” do
action :install
end
service “mysql” do
action [:enable, :...
Chef Management & Dev Tools
Automation of SysAdmin using Chef
Tools
ChefDK
• Knife
• Chef-solo
• Chef-zero
• Berkshelf
• Test Kitchen
• Foodcritic
Vag...
Automation of SysAdmin using Chef
Berkshelf
Manage a Cookbook or an Application's Cookbook dependencies
Integrates and pla...
Example Application
Automation of SysAdmin using Chef
Example Application
Automation of SysAdmin using Chef
Recipes
nateApp::database_server
nateApp::content_server
nateApp::web_server
nateApp::lo...
Automation of SysAdmin using Chef
Default Recipe
include_recipe "nateApp::database_server"
include_recipe "nateApp::conten...
Automation of SysAdmin using Chef
Recipes myNateApp
myNateApp::database_server
myNateApp::content_server
myNateApp::web_se...
Automation of SysAdmin using Chef
myNateApp::web_server
content_servers_search = search(:node, "recipes:nateApp::content_s...
The Future
Automation of SysAdmin using Chef
Infrastucture as Code
Chef Provisioning is powerful new Chef featureset lets you create ...
Thank You
of 24

NATE-CHEF

Published on: Mar 3, 2016
Source: www.slideshare.net


Transcripts - NATE-CHEF

  • 1. Automation of SysAdmin using Chef Senior Technical Specialist Technical Support Services – Computing Platforms University of Cape Town Stefan Coetzee Information & Communication Technology Services
  • 2. Automation of SysAdmin using Chef
  • 3. Components
  • 4. Automation of SysAdmin using Chef Components • Chef-Server • Roles • Environments • Chef-Client (node) • Knife • Cookbooks • Recipes • LWRP (Lightweight Resource Provider) • Attributes • Templates • Data Bags
  • 5. Recipes & Cookbooks?
  • 6. Automation of SysAdmin using Chef Recipes & Cookbooks? What are they? Where do I get them? How can I customize them? Structure
  • 7. Automation of SysAdmin using Chef What are they? A recipe is a list of instructions on how to install and configure a specific package/system/component. They accomplish was recipes accomplish in real life, tell us how to bake a cake. A cookbook is a collection of recipes, so the CAKE cookbook will have a number of recipes, eg Chocolate, Orange, etc etc
  • 8. Automation of SysAdmin using Chef Where do I get them? Where do you usually get your ingredients from, the supermarket of course. They most commonly used cookbooks are available @ https://supermarket.chef.io/. These cookbooks are preconfigure and useable without any modification. These include Apache, Mysql, Tomcat, Postgres, Java, Microsoft SQL
  • 9. Automation of SysAdmin using Chef How can I customize them? • Fork them on Github • Include them into you own recipe (List as dependency)
  • 10. Automation of SysAdmin using Chef Structure -rw-r--r-- 1 501 20 142 Apr 22 15:01 Berksfile -rw------- 1 501 20 311 May 21 14:23 Berksfile.lock -rw-r--r-- 1 501 20 36 Feb 13 10:13 CHANGELOG.md -rw-r--r-- 1 501 20 449 Feb 13 10:13 Gemfile -rw-r--r-- 1 501 20 72 Feb 13 10:13 LICENSE -rw-r--r-- 1 501 20 1693 Feb 13 10:13 README.md -rw-r--r-- 1 501 20 241 Feb 13 10:13 Thorfile -rw-r--r-- 1 501 20 4792 May 20 09:22 Vagrantfile drwxr-xr-x 3 501 20 102 May 20 09:30 attributes -rw-r--r-- 1 501 20 960 Feb 13 10:13 chefignore drwxr-xr-x 3 501 20 102 Feb 13 10:13 files -rw-r--r-- 1 501 20 319 May 18 09:15 metadata.rb drwxr-xr-x 6 501 20 204 May 20 09:28 recipes drwxr-xr-x 3 501 20 102 Feb 13 10:13 templates
  • 11. Abstraction is Key
  • 12. Automation of SysAdmin using Chef Abstraction package “nginx” do action :install end service “mysql” do action [:enable, :start] end
  • 13. Chef Management & Dev Tools
  • 14. Automation of SysAdmin using Chef Tools ChefDK • Knife • Chef-solo • Chef-zero • Berkshelf • Test Kitchen • Foodcritic Vagrant • Providers • VirtualBox • VMWare • Hyper-V • Provisioners
  • 15. Automation of SysAdmin using Chef Berkshelf Manage a Cookbook or an Application's Cookbook dependencies Integrates and plays well with VAGRANT Vagrant Vagrant is a tool for building complete development environments. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases development/production parity, and makes the "works on my machine" excuse a relic of the past.
  • 16. Example Application
  • 17. Automation of SysAdmin using Chef Example Application
  • 18. Automation of SysAdmin using Chef Recipes nateApp::database_server nateApp::content_server nateApp::web_server nateApp::loadbalancer
  • 19. Automation of SysAdmin using Chef Default Recipe include_recipe "nateApp::database_server" include_recipe "nateApp::content_server" include_recipe "nateApp::web_server”
  • 20. Automation of SysAdmin using Chef Recipes myNateApp myNateApp::database_server myNateApp::content_server myNateApp::web_server myNateApp::loadbalancer
  • 21. Automation of SysAdmin using Chef myNateApp::web_server content_servers_search = search(:node, "recipes:nateApp::content_server AND chef_environment:#{node.chef_environment}") content_servers = [] content_servers_search.each do |content_server| content_servers.push(content_server.ipaddress) end node.set['nateApp']['content_servers'] = content_servers db_server = search(:node, "recipes:nateApp::database_server AND chef_environment:#{node.chef_environment}") node.set['nateApp']['database']['host'] = db_server[0].ipaddress include_recipe "nateApp::web_server"
  • 22. The Future
  • 23. Automation of SysAdmin using Chef Infrastucture as Code Chef Provisioning is powerful new Chef featureset lets you create and converge machines, images, load balancers and other infrastructure, no matter where they are: cloud, bare metal, virtual machines, or containers.
  • 24. Thank You

Related Documents