SlideShare ist ein Scribd-Unternehmen logo
1 von 53
ChefInfrastructure as code
Chef
Background Opscode (HJK Solutions)
Chef has Recipes Resources Roles Nodes Cookbooks Knife
Fully Automated Infrastructure
Provisioning Bare-metal: Kickstart/jumpstart VM: libvert Cloud: AWS/vCloud Cloud: fog (http://fog.io/)
Configuration Management
Systems Integration the last mile of fully automated infrastructure Metadata stored & indexed Search API
Chef principles Idempotent Thick Clients, Thin Server Order Matters
Why chef? Economics Efficiency Scalability Community
Flavors of Chef Chef client & Chef server Hosted Chef Chef solo
Architecture
A Chef run
Chef client     Client does all the work, and can run recipes for multiple Nodes.
Chef server API service. Management Console (optional). AMQP Server Search indexer and Search Engine. Data store with CouchDB.
Chef solo -c, --config CONFIG -j, --json-attributes JSON_ATTRIBS -r, --recipe-url RECIPE_URL
Cookbook
Cookbook     Cookbooks are the fundamental units of distribution in Chef.
Cookbook attributes/ definitions/ files/ libraries/ metadata.rb providers/ recipes/ resources/ templates/
Cookbook Dev in chef-repo Create our own cookbook Or download from community Upload to Chef server
Cookbook command knife cookbook list knife cookbook create COOKBOOK knife cookbook download COOKBOOK knife cookbook upload [COOKBOOKS...] knife cookbook delete COOKBOOK knife cookbook metadata COOKBOOK
 Chef Community Cookbook Site  knife cookbook site list knife cookbook site share COOKBOOK CATEGORY knife cookbook site install COOKBOOK knife cookbook site unshare COOKBOOK knife cookbook site search QUERY knife cookbook site download COOKBOOK
Cookbook Dependencies  In metadata.rb: depends "apache2", ">= 0.99.4" depends "mysql", ">= 1.0.5"
Attributes node.default[:apache][:dir] = "/etc/apache2" node.default[:apache][:listen_ports] = [ "80", "443" ] if node.apache.attribute?(”dir")   # do something end
Nodes Nodes in Chef are the thing that are configured by Recipes.  recipe/role attribute
Roles name "webserver" description "The base role for systems that serve HTTP traffic" run_list "recipe[apache2]", "recipe[apache2::mod_ssl]", "role[monitor]" env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"] default_attributes "apache2" => { "listen_ports" => [ "80", "443" ] } override_attributes "apache2" => { "max_children" => "50" }
Search knife search node "id:foo OR id:abc” search(:node, 'run_list:recipefoobar') do |matching_node|   puts matching_node.to_s end
Libraries your_cookbook/libraries/your_example_library.rb module YourExampleLibrary   def your_function()     # ... do something useful     end End your_cookbook/recipes/default.rb class Chef::Recipe   include YourExampleLibrary end your_function()
Metadata maintainter "bob" maintainer_email "bob@gmail.com" license "Apache v2.0" description "A cookbook" long_description "blablabla" depends "mysql", ">= 1.0.1" version "2.0.1" recipe "A recipe", "blablabla"
Templates template "/etc/sudoers" do   source "sudoers.erb"   mode 0440   owner "root"   group "root"   variables(     :sudoers_groups => node[:authorization][:sudo][:groups],     :sudoers_users => node[:authorization][:sudo][:users]   ) end
Recipes stored in Cookbooks. executed in the order they appear. evaluated as Ruby code. Recipes from other Cookbooks can be included with include_recipe. All the attributes of the current Node are available via the node object.
Resources such as: packages services users files directories
Resources: cookbook_file cookbook_file "/tmp/testfile" do   source "testfile" # this is the value that would be inferred from the path parameter   mode "0644" end
Resources: directory %w{dir1 dir2 dir3}.each do |dir|    directory "/tmp/mydirs/#{dir}" do       mode 0775       owner "root"       group "root"       action :create       recursive true    end end
Resources: remote file remote_file "/tmp/testfile" do   source "http://www.example.com/tempfiles/testfile"   mode "0644"   checksum "08da002l" # A SHA256 (or portion thereof) of the file. end
Resources: package package "tar" do   version "1.16.1-1"   action :install end
Resources: script script "install_something" do   interpreter "bash"   user "root" cwd "/tmp"   code <<-EOH wget http://www.example.com/tarball.tar.gz   tar -zxftarball.tar.gz cdtarball   ./configure   make   make install   EOH end
Quick start
Quick Start ,[object Object]
Local workstation(MaxOSX)
One node(VM Ubuntu),[object Object],[object Object]
Workstation Setup ,[object Object],         - Ruby 1.8.7+              - RubyGems1.3.7+ ,[object Object]
Create Chef repository            - gitclone git://github.com/opscode/chef-repo.git ,[object Object],             - Create .chef directory               - Copy the private keys and knife cpUSERNAME.pem ~/chef-repo/.chef cpORGANIZATION-validator.pem ~/chef-repo/.chef cpknife.rb ~/chef-repo/.chef
Set up a node as Chef Client ,[object Object],      knife cookbook site install chef-client ,[object Object],knife cookbook upload ,[object Object],knife bootstrap 10.1.1.110 -r 'recipe[chef-client]' –x          username –P password --sudo
Verify node data List all the node:  knife node list List the run list for a specific node: knife node show nodename –r
Working with git
get chef-repo git clone git://github.com/opscode/chef-repo.git
repo tree config/ - Contains the Rake configuration file, rake.rb. cookbooks/ - Cookbooks you download or create. data_bags/ - Store data bags and items in .json in the repository. roles/ - Store roles in .rb or .json in the repository. certificates/ - SSL certificates generated by rake ssl_cert live here.
working with git Building a new cookbook and saving it to the local repository. Downloading an existing cookbook from the Chef Community Site. Modifying an existing cookbook in the local repository for new updates.
Doc & Help
working with git wik: http://wiki.opscode.com/display/chef/Home community:     http://community.opscode.com/cookbooks

Weitere Àhnliche Inhalte

Was ist angesagt?

Chef-Zero & Local Mode
Chef-Zero & Local ModeChef-Zero & Local Mode
Chef-Zero & Local ModeMichael Goetz
 
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...Chef Software, Inc.
 
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...Chef Software, Inc.
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to ChefKnoldus Inc.
 
Introduction to Chef: Automate Your Infrastructure by Modeling It In Code
Introduction to Chef: Automate Your Infrastructure by Modeling It In CodeIntroduction to Chef: Automate Your Infrastructure by Modeling It In Code
Introduction to Chef: Automate Your Infrastructure by Modeling It In CodeJosh Padnick
 
Understand Chef
Understand ChefUnderstand Chef
Understand Chefdevopsjourney
 
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Software, Inc.
 
Overview of chef ( Infrastructure as a Code )
Overview of chef ( Infrastructure as a Code )Overview of chef ( Infrastructure as a Code )
Overview of chef ( Infrastructure as a Code )Pravin Mishra
 
Compliance as Code
Compliance as CodeCompliance as Code
Compliance as CodeMatt Ray
 
Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Jennifer Davis
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with ChefKen Robertson
 
Introduction to Chef - Techsuperwomen Summit
Introduction to Chef - Techsuperwomen SummitIntroduction to Chef - Techsuperwomen Summit
Introduction to Chef - Techsuperwomen SummitJennifer Davis
 
Chef Tutorial for DEVOPS Newbies
Chef Tutorial for DEVOPS NewbiesChef Tutorial for DEVOPS Newbies
Chef Tutorial for DEVOPS NewbiesMamun Rashid, CCDH
 
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...Chef Software, Inc.
 
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6Chef
 
Velocity2011 chef-workshop
Velocity2011 chef-workshopVelocity2011 chef-workshop
Velocity2011 chef-workshopjtimberman
 
Node object and roles - Fundamentals Webinar Series Part 3
Node object and roles - Fundamentals Webinar Series Part 3Node object and roles - Fundamentals Webinar Series Part 3
Node object and roles - Fundamentals Webinar Series Part 3Chef
 

Was ist angesagt? (20)

Chef-Zero & Local Mode
Chef-Zero & Local ModeChef-Zero & Local Mode
Chef-Zero & Local Mode
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chef
 
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
 
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chef
 
Introduction to Chef: Automate Your Infrastructure by Modeling It In Code
Introduction to Chef: Automate Your Infrastructure by Modeling It In CodeIntroduction to Chef: Automate Your Infrastructure by Modeling It In Code
Introduction to Chef: Automate Your Infrastructure by Modeling It In Code
 
Understand Chef
Understand ChefUnderstand Chef
Understand Chef
 
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of Chef
 
Overview of chef ( Infrastructure as a Code )
Overview of chef ( Infrastructure as a Code )Overview of chef ( Infrastructure as a Code )
Overview of chef ( Infrastructure as a Code )
 
Compliance as Code
Compliance as CodeCompliance as Code
Compliance as Code
 
Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
Introduction to Chef - Techsuperwomen Summit
Introduction to Chef - Techsuperwomen SummitIntroduction to Chef - Techsuperwomen Summit
Introduction to Chef - Techsuperwomen Summit
 
Introduction to chef
Introduction to chefIntroduction to chef
Introduction to chef
 
Chef Tutorial for DEVOPS Newbies
Chef Tutorial for DEVOPS NewbiesChef Tutorial for DEVOPS Newbies
Chef Tutorial for DEVOPS Newbies
 
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
 
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
 
Velocity2011 chef-workshop
Velocity2011 chef-workshopVelocity2011 chef-workshop
Velocity2011 chef-workshop
 
Chef Cookbook Workflow
Chef Cookbook WorkflowChef Cookbook Workflow
Chef Cookbook Workflow
 
Node object and roles - Fundamentals Webinar Series Part 3
Node object and roles - Fundamentals Webinar Series Part 3Node object and roles - Fundamentals Webinar Series Part 3
Node object and roles - Fundamentals Webinar Series Part 3
 

Andere mochten auch

Chef for DevOps - an Introduction
Chef for DevOps - an IntroductionChef for DevOps - an Introduction
Chef for DevOps - an IntroductionSanjeev Sharma
 
Chef - Infrastructure Automation for the Masses
Chef - Infrastructure Automation for the Masses�Chef - Infrastructure Automation for the Masses�
Chef - Infrastructure Automation for the MassesSai Perchard
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefAll Things Open
 
Infrastructure as Code with Chef
Infrastructure as Code with ChefInfrastructure as Code with Chef
Infrastructure as Code with ChefSarah Hynes Cheney
 
àžžàžŽàžŠàžàžČàž™àžŽàž™ àčàžœàčˆàž™àžžàž±àžš
àžžàžŽàžŠàžàžČàž™àžŽàž™ àčàžœàčˆàž™àžžàž±àžšàžžàžŽàžŠàžàžČàž™àžŽàž™ àčàžœàčˆàž™àžžàž±àžš
àžžàžŽàžŠàžàžČàž™àžŽàž™ àčàžœàčˆàž™àžžàž±àžšchisuminho
 
Chef in a nutshell
Chef in a nutshellChef in a nutshell
Chef in a nutshellRoberto Gaiser
 
Testable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and DockerTestable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and DockerMandi Walls
 
CHEF - by Scott Russel
CHEF - by Scott RusselCHEF - by Scott Russel
CHEF - by Scott RusselKangaroot
 
Infrastructure Automation How to Use Chef For DevOps Success
Infrastructure Automation How to Use Chef For DevOps SuccessInfrastructure Automation How to Use Chef For DevOps Success
Infrastructure Automation How to Use Chef For DevOps SuccessDynatrace
 
The professional chef
The professional chefThe professional chef
The professional chefkellimccabe
 
Chef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous IntegrationChef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous IntegrationJulian Dunn
 
Deep Dive - Infrastructure as Code
Deep Dive - Infrastructure as CodeDeep Dive - Infrastructure as Code
Deep Dive - Infrastructure as CodeAmazon Web Services
 
Infrastructure Automation with Chef
Infrastructure Automation with ChefInfrastructure Automation with Chef
Infrastructure Automation with ChefAdam Jacob
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHErica Windisch
 

Andere mochten auch (17)

Chef for DevOps - an Introduction
Chef for DevOps - an IntroductionChef for DevOps - an Introduction
Chef for DevOps - an Introduction
 
Chef - Infrastructure Automation for the Masses
Chef - Infrastructure Automation for the Masses�Chef - Infrastructure Automation for the Masses�
Chef - Infrastructure Automation for the Masses
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
 
Chef For OpenStack Overview
Chef For OpenStack OverviewChef For OpenStack Overview
Chef For OpenStack Overview
 
Infrastructure as Code with Chef / Puppet
Infrastructure as Code with Chef / PuppetInfrastructure as Code with Chef / Puppet
Infrastructure as Code with Chef / Puppet
 
Infrastructure as Code with Chef
Infrastructure as Code with ChefInfrastructure as Code with Chef
Infrastructure as Code with Chef
 
àžžàžŽàžŠàžàžČàž™àžŽàž™ àčàžœàčˆàž™àžžàž±àžš
àžžàžŽàžŠàžàžČàž™àžŽàž™ àčàžœàčˆàž™àžžàž±àžšàžžàžŽàžŠàžàžČàž™àžŽàž™ àčàžœàčˆàž™àžžàž±àžš
àžžàžŽàžŠàžàžČàž™àžŽàž™ àčàžœàčˆàž™àžžàž±àžš
 
Chef in a nutshell
Chef in a nutshellChef in a nutshell
Chef in a nutshell
 
Testable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and DockerTestable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and Docker
 
CHEF - by Scott Russel
CHEF - by Scott RusselCHEF - by Scott Russel
CHEF - by Scott Russel
 
Infrastructure Automation How to Use Chef For DevOps Success
Infrastructure Automation How to Use Chef For DevOps SuccessInfrastructure Automation How to Use Chef For DevOps Success
Infrastructure Automation How to Use Chef For DevOps Success
 
The professional chef
The professional chefThe professional chef
The professional chef
 
Chef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous IntegrationChef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous Integration
 
Deep Dive - Infrastructure as Code
Deep Dive - Infrastructure as CodeDeep Dive - Infrastructure as Code
Deep Dive - Infrastructure as Code
 
Infrastructure Automation with Chef
Infrastructure Automation with ChefInfrastructure Automation with Chef
Infrastructure Automation with Chef
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
 
DevOps and Chef
DevOps and ChefDevOps and Chef
DevOps and Chef
 

Ähnlich wie ChefInfrastructure as Code Guide

Cook Infrastructure with chef -- Justeat.IN
Cook Infrastructure with chef  -- Justeat.INCook Infrastructure with chef  -- Justeat.IN
Cook Infrastructure with chef -- Justeat.INRajesh Hegde
 
Introduction to chef framework
Introduction to chef frameworkIntroduction to chef framework
Introduction to chef frameworkmorgoth
 
DevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefDevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefAntons Kranga
 
Chef or how to make computers do the work for us
Chef or how to make computers do the work for usChef or how to make computers do the work for us
Chef or how to make computers do the work for ussickill
 
Kickstarter - Chef Opswork
Kickstarter - Chef OpsworkKickstarter - Chef Opswork
Kickstarter - Chef OpsworkHamza Waqas
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chefkevsmith
 
Chef infrastructure as code - paris.rb
Chef infrastructure as code - paris.rbChef infrastructure as code - paris.rb
Chef infrastructure as code - paris.rbNicolas Ledez
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode ChefSri Ram
 
Azure handsonlab
Azure handsonlabAzure handsonlab
Azure handsonlabChef
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode ChefSri Ram
 
Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015Chef
 
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013Amazon Web Services
 
Introduction To Continuous Compliance & Remediation
Introduction To Continuous Compliance & RemediationIntroduction To Continuous Compliance & Remediation
Introduction To Continuous Compliance & RemediationNicole Johnson
 
How to Write Chef Cookbook
How to Write Chef CookbookHow to Write Chef Cookbook
How to Write Chef Cookbookdevopsjourney
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode ChefSri Ram
 
Chef training - Day2
Chef training - Day2Chef training - Day2
Chef training - Day2Andriy Samilyak
 
Chef for openstack
Chef for openstackChef for openstack
Chef for openstackopenstackindia
 

Ähnlich wie ChefInfrastructure as Code Guide (20)

Cook Infrastructure with chef -- Justeat.IN
Cook Infrastructure with chef  -- Justeat.INCook Infrastructure with chef  -- Justeat.IN
Cook Infrastructure with chef -- Justeat.IN
 
Chef
ChefChef
Chef
 
Introduction to chef framework
Introduction to chef frameworkIntroduction to chef framework
Introduction to chef framework
 
DevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefDevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of Chef
 
IT Automation with Chef
IT Automation with ChefIT Automation with Chef
IT Automation with Chef
 
Chef or how to make computers do the work for us
Chef or how to make computers do the work for usChef or how to make computers do the work for us
Chef or how to make computers do the work for us
 
Kickstarter - Chef Opswork
Kickstarter - Chef OpsworkKickstarter - Chef Opswork
Kickstarter - Chef Opswork
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chef
 
Chef infrastructure as code - paris.rb
Chef infrastructure as code - paris.rbChef infrastructure as code - paris.rb
Chef infrastructure as code - paris.rb
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode Chef
 
Azure handsonlab
Azure handsonlabAzure handsonlab
Azure handsonlab
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode Chef
 
Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015
 
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
 
Introduction To Continuous Compliance & Remediation
Introduction To Continuous Compliance & RemediationIntroduction To Continuous Compliance & Remediation
Introduction To Continuous Compliance & Remediation
 
How to Write Chef Cookbook
How to Write Chef CookbookHow to Write Chef Cookbook
How to Write Chef Cookbook
 
Chef
ChefChef
Chef
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode Chef
 
Chef training - Day2
Chef training - Day2Chef training - Day2
Chef training - Day2
 
Chef for openstack
Chef for openstackChef for openstack
Chef for openstack
 

KĂŒrzlich hochgeladen

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...gurkirankumar98700
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

KĂŒrzlich hochgeladen (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

ChefInfrastructure as Code Guide

  • 4. Chef has Recipes Resources Roles Nodes Cookbooks Knife
  • 6. Provisioning Bare-metal: Kickstart/jumpstart VM: libvert Cloud: AWS/vCloud Cloud: fog (http://fog.io/)
  • 8. Systems Integration the last mile of fully automated infrastructure Metadata stored & indexed Search API
  • 9. Chef principles Idempotent Thick Clients, Thin Server Order Matters
  • 10. Why chef? Economics Efficiency Scalability Community
  • 11. Flavors of Chef Chef client & Chef server Hosted Chef Chef solo
  • 13.
  • 15.
  • 16. Chef client Client does all the work, and can run recipes for multiple Nodes.
  • 17. Chef server API service. Management Console (optional). AMQP Server Search indexer and Search Engine. Data store with CouchDB.
  • 18. Chef solo -c, --config CONFIG -j, --json-attributes JSON_ATTRIBS -r, --recipe-url RECIPE_URL
  • 20. Cookbook Cookbooks are the fundamental units of distribution in Chef.
  • 21. Cookbook attributes/ definitions/ files/ libraries/ metadata.rb providers/ recipes/ resources/ templates/
  • 22. Cookbook Dev in chef-repo Create our own cookbook Or download from community Upload to Chef server
  • 23. Cookbook command knife cookbook list knife cookbook create COOKBOOK knife cookbook download COOKBOOK knife cookbook upload [COOKBOOKS...] knife cookbook delete COOKBOOK knife cookbook metadata COOKBOOK
  • 24. Chef Community Cookbook Site knife cookbook site list knife cookbook site share COOKBOOK CATEGORY knife cookbook site install COOKBOOK knife cookbook site unshare COOKBOOK knife cookbook site search QUERY knife cookbook site download COOKBOOK
  • 25. Cookbook Dependencies In metadata.rb: depends "apache2", ">= 0.99.4" depends "mysql", ">= 1.0.5"
  • 26. Attributes node.default[:apache][:dir] = "/etc/apache2" node.default[:apache][:listen_ports] = [ "80", "443" ] if node.apache.attribute?(”dir") # do something end
  • 27. Nodes Nodes in Chef are the thing that are configured by Recipes. recipe/role attribute
  • 28. Roles name "webserver" description "The base role for systems that serve HTTP traffic" run_list "recipe[apache2]", "recipe[apache2::mod_ssl]", "role[monitor]" env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"] default_attributes "apache2" => { "listen_ports" => [ "80", "443" ] } override_attributes "apache2" => { "max_children" => "50" }
  • 29. Search knife search node "id:foo OR id:abc” search(:node, 'run_list:recipefoobar') do |matching_node| puts matching_node.to_s end
  • 30. Libraries your_cookbook/libraries/your_example_library.rb module YourExampleLibrary def your_function() # ... do something useful end End your_cookbook/recipes/default.rb class Chef::Recipe include YourExampleLibrary end your_function()
  • 31. Metadata maintainter "bob" maintainer_email "bob@gmail.com" license "Apache v2.0" description "A cookbook" long_description "blablabla" depends "mysql", ">= 1.0.1" version "2.0.1" recipe "A recipe", "blablabla"
  • 32. Templates template "/etc/sudoers" do source "sudoers.erb" mode 0440 owner "root" group "root" variables( :sudoers_groups => node[:authorization][:sudo][:groups], :sudoers_users => node[:authorization][:sudo][:users] ) end
  • 33. Recipes stored in Cookbooks. executed in the order they appear. evaluated as Ruby code. Recipes from other Cookbooks can be included with include_recipe. All the attributes of the current Node are available via the node object.
  • 34. Resources such as: packages services users files directories
  • 35. Resources: cookbook_file cookbook_file "/tmp/testfile" do source "testfile" # this is the value that would be inferred from the path parameter mode "0644" end
  • 36. Resources: directory %w{dir1 dir2 dir3}.each do |dir| directory "/tmp/mydirs/#{dir}" do mode 0775 owner "root" group "root" action :create recursive true end end
  • 37. Resources: remote file remote_file "/tmp/testfile" do source "http://www.example.com/tempfiles/testfile" mode "0644" checksum "08da002l" # A SHA256 (or portion thereof) of the file. end
  • 38. Resources: package package "tar" do version "1.16.1-1" action :install end
  • 39. Resources: script script "install_something" do interpreter "bash" user "root" cwd "/tmp" code <<-EOH wget http://www.example.com/tarball.tar.gz tar -zxftarball.tar.gz cdtarball ./configure make make install EOH end
  • 41.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47. Verify node data List all the node: knife node list List the run list for a specific node: knife node show nodename –r
  • 49. get chef-repo git clone git://github.com/opscode/chef-repo.git
  • 50. repo tree config/ - Contains the Rake configuration file, rake.rb. cookbooks/ - Cookbooks you download or create. data_bags/ - Store data bags and items in .json in the repository. roles/ - Store roles in .rb or .json in the repository. certificates/ - SSL certificates generated by rake ssl_cert live here.
  • 51. working with git Building a new cookbook and saving it to the local repository. Downloading an existing cookbook from the Chef Community Site. Modifying an existing cookbook in the local repository for new updates.
  • 53. working with git wik: http://wiki.opscode.com/display/chef/Home community: http://community.opscode.com/cookbooks

Hinweis der Redaktion

  1. Manage your servers by writing code, not by running commands. With Chef, you write abstract definitions as source code to describe how you want each part of your infrastructure to be built, and then apply those descriptions to individual servers. The result is a fully automated infrastructure: when a new server comes on line, the only thing you have to do is tell Chef what role it should play in your architecture.
  2. Recipes: written in ruby using DSL. A Recipe describes a series of resources that should be in a particular state on a particular part of a server (such as Apache, MySQL, or Hadoop).Resource: A resource is usually a cross platform abstraction of the thing you&apos;re configuring on the host.A role sets a list of recipes and attributes to apply to a nodeA cookbook is a collection of recipes.Knife is the command line interface to the Chef server
  3. Kickstart: a file for installation questionsLibvert: The virtualization API, XEN, VMWare, Vitural Box, KVM
Amazon Web Services/Elastic Computer CloudFog: Ruby cloud services library
  4. Chef recipes can be data driven thereby providing dynamic system integration between servers. For example, when configuring a web server the search API can be called to discover the database and memcache servers and then automatically update the web server’s configuration. Likewise a load balancer recipe can automatically add the web servers into its configuration.
  5. Chef ensures that actions are not performed if the resources have not changedThe Chef Server is built to handle the easy distribution of data to the clients - the recipes to build, templates to render, files to transfer - along with storing the state of each Node.given the same set of Cookbooks, Chef will always execute your resources in the same order.
  6. Chef Solo: is a client application that works entirely from on-disk data, and is a light-weight alternative to a full client-server configuration.Chef Client: is the client application that works with a Chef Server to persist data and download cookbooks. Chef Clients can also take advantage of Chef Server&apos;s search abilities to dynamically integrate your applications with the rest of your infrastructure.Knife: is the command line interface to Chef. Knife is primarily used to interact with the Chef Server API, and it can be used for local Chef Repository maintenance.Shef: is the interactive Chef shell. Shef allows you to write, run, and debug recipes interactively and also provides a programmatic interface for viewing and editing data on your Chef Server.Chef Server: services HTTP API requests from the Web UI, nodes, and other clients (see above).Chef Server Web UI: the web-based management console for the Chef Server. It manages your infrastructure by making API calls to Chef Server.CouchDB: the primary data store for a Chef server.RabbitMQ: stores and then forwards data from Chef Server to the Chef Solr Indexer. It acts as a buffer for cases when high write loads temporarily exceed the ability of the Chef Solr Indexer to update the search index.Chef Solr Indexer: flattens and expands data to enhance searchability, then writes the data to Chef Solr.Chef Solr: a thin wrapper around the Apache Solr search engine. Chef Solr allows you to find your way around your infrastructure by querying its metadata.
  7. Clients are where all the action happens - the Chef Server and Chef Indexer are largely services that exist only to provide the Client with information.
  8. MerbAPI service for knife &amp; Management consoleRabbitMQSolrChef Server utilizes CouchDB for storing JSON data about Nodes, Roles, and Data Bags.
  9. Config:file_cache_path &quot;/var/chef-solo&quot;cookbook_path &quot;/var/chef-solo/cookbooks”cookbook_path [&quot;/var/chef-solo/cookbooks&quot;, &quot;/var/chef-solo/site-cookbooks&quot;]role_path &quot;/var/chef-solo/roles”chef-solo -c ~/solo.rb -j http://www.example.com/node.json -rhttp://www.example.com/chef-solo.tar.gz
  10. Config:file_cache_path &quot;/var/chef-solo&quot;cookbook_path &quot;/var/chef-solo/cookbooks”cookbook_path [&quot;/var/chef-solo/cookbooks&quot;, &quot;/var/chef-solo/site-cookbooks&quot;]role_path &quot;/var/chef-solo/roles”chef-solo -c ~/solo.rb -j http://www.example.com/node.json -rhttp://www.example.com/chef-solo.tar.gz
  11. Config:file_cache_path &quot;/var/chef-solo&quot;cookbook_path &quot;/var/chef-solo/cookbooks”cookbook_path [&quot;/var/chef-solo/cookbooks&quot;, &quot;/var/chef-solo/site-cookbooks&quot;]role_path &quot;/var/chef-solo/roles”chef-solo -c ~/solo.rb -j http://www.example.com/node.json -rhttp://www.example.com/chef-solo.tar.gz
  12. Hash key value (Mash)Default/override/setAttributes are Node data such as the IP address, hostname, loaded kernel modules, version of programming languages available on the system and more. New attributes can be dynamically added to the node in a variety of ways.During the Chef run, the Chef Client saves these node attributes on the Chef Server where they are indexed for Search. When the Chef Client runs again, it will retrieve the attributes that were saved previously and merge in attributes based on the priority rules described below.
  13. Chef Cookbooks require you to specify a small amount of meta-data. This information is used to provide hints to the Chef Server as to what cookbooks should be deployed to a given node, and in the future it will be integral to an automated system for discovering and installing cookbooks.
  14. Chef Cookbooks require you to specify a small amount of meta-data. This information is used to provide hints to the Chef Server as to what cookbooks should be deployed to a given node, and in the future it will be integral to an automated system for discovering and installing cookbooks.
  15. Search is a feature of the Chef Server that allows you to use a full-text search engine (based on Apache Solr) to query information about your infrastructure and applications. Searches are built by the Chef Server, and allow you to query arbitrary data about your infrastructure. You can utilize this service via search calls in a recipe or the knife search command.Most data that Chef stores in CouchDB is automatically indexed in Solr: Data Bags, API Clients, Nodes, and Roles are all indexed.
  16. Libraries allow you to include arbitrary Ruby code, either to extend Chef&apos;s language or to implement your own classes directly. They are the secret sauce that will allow you to plug in to your existing infrastructure and utilize it to inform how your systems are configured.
  17. Chef Cookbooks require you to specify a small amount of meta-data. This information is used to provide hints to the Chef Server as to what cookbooks should be deployed to a given node, and in the future it will be integral to an automated system for discovering and installing cookbooks.
  18. Template Location Specificity
  19. Recipes are the fundamental configuration in Chef. Recipes encapsulate collections of resources which are executed in the order defined to configure the systemRecipes are an internal Ruby domain-specific language (DSL), but you do not need to have experience with Ruby to write recipes.knife node run list add NODENAME &quot;recipe[apache2]&quot;
  20. Recipes are the fundamental configuration in Chef. Recipes encapsulate collections of resources which are executed in the order defined to configure the systemRecipes are an internal Ruby domain-specific language (DSL), but you do not need to have experience with Ruby to write recipes.knife node run list add NODENAME &quot;recipe[apache2]&quot;