SlideShare a Scribd company logo
1 of 99
INTRODUCTION TO CHEF – BY DAMITH KOTHALAWALA ,MBCS
Content Acknowledgement
Most of the internal content are from https://docs.chef.io
CHEF™ logo is a registered trademark of Chef.io
Please do not copy/redistribute without taking prior permission from chef.io
About Me I am Damith Rushika Kothalawala and I work for Pearson as a Technical
Specialist. (Application Solutions Engineering)
I currently owns Basic Chef Fluency Badge from CHEF Certification + 4 other
Certifications from different vendors.
Find more about me @: https://www.linkedin.com/in/damithkothalawala/
Official Approval from CHEF.io
(C) DAMITH RUSHIKA KOTHALAWALA 2017
What is Chef
Chef is an open-source systems management and cloud
infrastructure automation framework created by Opscode.
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Why named as Chef ??
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Traditional Chef
1. Chef creates new recipes after undergoing several experimenting with food.
2. Chef has a book with his favorite recipes, which is called a “Cook Book”
3. One Chef can have many “Cook Books” which contains various types of food.
❖ Chinese Food Cookbook
❖ Cookbook of Soups
❖ Cookbook of Sauces
❖ Traditional Sri Lankan Cuisine Cookbook
4. There can be relationships between two Cookbooks when its comes to food
preparation
❖ Chef may have to refer one recipe of Cookbook of Sauces when making a soup from Cookbook of Soups
➢ Ex. Sometimes you need Soya Sauce to prepare a “Tom Yum” Soup.
5. Chef needs a Kitchen & Knife to do his preparation of food.
(C) DAMITH RUSHIKA KOTHALAWALA 2017
So what is the similarity ?
OpsCode’s Chef does the same as a traditional Chef in
theory, but OpsCode chef is for the system/infra
automation.
Thinking about OpsCode’s chef this way will help you to
understand its use well.
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Let's discuss about
CI/CD & DevOps
CI/CD
Continuous Delivery (CD) is the practice of using
automation to produce releasable software in
short iterations, allowing teams to ship working
software more frequently. The recent emphasis
on continuous integration, built-in testing,
constant monitoring, and analytics feedback all
point towards an overall trend in the software
industry: increasing the ability to react. As
organizations explore what these changes mean
for them, they invariably discover continuous
delivery which is commonly known as CD.
(C) DAMITH RUSHIKA KOTHALAWALA 2017
DevOPS
DevOps (a clipped compound of "software DEVelopment" and "information technology
OPerationS") is a term used to refer to a set of practices that emphasize the collaboration and
communication of both software developers and information technology (IT) professionals
while automating the process of software delivery and infrastructure changes – Wikipedia
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Let's go back to …
(C) DAMITH RUSHIKA KOTHALAWALA 2017
A Single Practical activity is better than
1000 words..
Let’s start learning by doing it ;-)
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Download ChefDK (Development Kit)
Please navigate to https://downloads.chef.io/chefdk then download relevant installer for your
OS
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Let’s verify your installation
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Let’s write recipes
As in ordinary cooking, you may have to do some R&D before you write a perfect recipe for your
cookbook. Let's start by writing one.
Something to know before We Start
o Chef software itself is written using a programming language called Ruby
o But you do not need to know about ruby to start working with chef
o Knowledge about a single programming language would be enough to work with Chef’s recipe files.
(C) DAMITH RUSHIKA KOTHALAWALA 2017
hello.rb
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Let’s run hello.rb recipe
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Let’s review what we have done
We have just created “File Resource” called
/tmp/hello.txt using chef
What is a Resource??
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Resource
A resource is a statement of configuration policy. It describes the
desired state of an element of your infrastructure and the steps
needed to bring that item to the desired state.
Source https://docs.chef.io/resources.html
As you know, anything is a file on
Anything on a system is a Resource for
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Resource Definition
(C) DAMITH RUSHIKA KOTHALAWALA 2017
file ‘/tmp/hello.txt' do
content 'Hello, world!'
end
The TYPE named NAME should be ACTION'd with PROPERTIES
Example Resources
(C) DAMITH RUSHIKA KOTHALAWALA 2017
What is chef-client
chef-client is an agent that runs locally on every node that is under
the management of Chef.
When a chef-client runs, it will perform all of the steps that is
required to bring the node into the expected state.
Source: https://docs.chef.io/chef_client.html
(C) DAMITH RUSHIKA KOTHALAWALA 2017
--local-mode (or -z)
chef-client's default mode attempts to contact a Chef Server and ask
for the recipes to run for the given node.
We override the behavior in order to have it work in the local mode.
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Recap: Apply the hello Recipe
(C) DAMITH RUSHIKA KOTHALAWALA 2017
What would happen if
the 'hello.txt' file
contents were
modified?
Test and Repair
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
What would happen if the file
• permissions (mode)
• Owner
• or group changed?
Have we define a policy for these properties?
chef-client’s work on Test & Repair
(C) DAMITH RUSHIKA KOTHALAWALA 2017
chef-client takes an action only when it needs to. Think of
it as test and repair. Chef looks at the current state of each
resource and takes an action only when that resource is out
of policy.
Let’s change properties of hello.txt
1. Read https://docs.chef.io/resources.html
2. Discover the file resource's:
◦ default action.
◦ default values for mode, owner, and group.
3. Update the file policy in "hello.rb" to:
The file named 'hello.txt' should be created with the content 'Hello,
world!', mode '0644', owner is 'root', and group is 'root'.
(C) DAMITH RUSHIKA KOTHALAWALA 2017
New hello.rb file
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Learn more on resources.
Likewise you can do many things with recipes when it
comes to a real deployment.
So please try to refer chef’s documentation and make some
changes on your local system.
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Traditional
Cookbook
As discussed, a real world cookbook is a collection of recipes
which can be
1. An Independent recipe
❑ ex. Steamed Rice Recipe
2. Related to one or more recipes on same cookbook
❑ ex. Fried Rice Recipe (You need streamed rice 1st to make
fried rice)
3. Related to one or more recipes on some other Cookbooks
❑ ex. Chinese Chopsuey Rice (You need. Multiple recipes
from many cookbooks if you make it without using
market products)
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
HUNGRY?
OpsCode’s Chef Cookbook
A Chef cookbook is the fundamental unit of configuration and policy
distribution.
Each cookbook defines a scenario, such as everything needed to
install and configure MySQL, and then it contains all of the
components that are required to support that scenario.
Read the first three paragraphs here:
http://docs.chef.io/cookbooks.html
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Cookbook
❑Recipes that specify the resources to use and the
order in which they are to be applied
❑ Attribute values
❑ File distributions
❑ Templates
❑ Extensions to Chef, such as libraries, definitions, and
custom resources
❑ Version Control
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Common Components of Cookbooks
1. README
2. metadata
3. Recipes
4. testing directories (spec + test)
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Let’s start with cookbook
creation
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Acknowledgement: This section is entirely copied from a chef.io training
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Let’s Come Back to Food
A recipe
from BBC
Food
http://www.bbc.co.uk/food/recipes
/roastedtomatoandthym_93625
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Most of the Recipes Cannot be
Customized on the fly
This one serves only 4. What happen if you want to make it for 2 or
10 ?
But what if that recipe got an option to customize
as per your requirement ? And adjust the recipe
as per those variables
Ex.
Please Enter Number of Servings
You need 5 baking potatoes
(C) DAMITH RUSHIKA KOTHALAWALA 2017
5
Let’s Learn About Chef Node
Attributes
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Node Attribute Definition
An attribute is a specific detail about a node. Attributes are used by the chef-client to
understand:
❑The current state of the node
❑What the state of the node was at the end of the previous chef-client run
❑What the state of the node should be at the end of the current chef-client run
Attributes are defined by:
❑The state of the node itself
❑Cookbooks (in attribute files and/or recipes)
❑Roles
❑Environments
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Ohai
Ohai is a tool that is used to detect
attributes on a node, and then provide
these attributes to the chef-client at the
start of every chef-client run
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Let’s
execute
ohai
command
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Details provided by ohai
Ohai will gather almost everything about your system and present its collected data in JSON
format.
Let's get some selected detail output
ohai memory/total
ohai memory/free
ohai cpu
ohai ipaddress
And etc…
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Let’s check node variables
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Let’s check node variables
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Let’s check node variables
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Sometimes we may need to customize any given installation/configuration
based on the type of your development/deployment or installation
requirements.
Examples.
1. Customized installation of a company developed software
2. Configuration files that should be updated on each new application
deployment.
(C) DAMITH RUSHIKA KOTHALAWALA 2017
Cookbook specific node attributes
Let’s try with a new Cookbook
(C) DAMITH RUSHIKA KOTHALAWALA 2017
#make sure to be at your $HOME
cd ~
#create new cookbooks called cms
chef generate cookbook cookbooks/cms
#now generate new recipe called default
chef generate recipe cookbooks/cms default
#Let’s create new attribute file
chef generate attribute cookbooks/cms default
Let’s declare some node variables
vim cookbooks/cms/attributes/default.rb
#Normally we define cookbook specific node variables in following way
#default[‘cookbookname’][‘var1’]=’value’
default[‘cms’][‘company`]=’cms’
default[‘cms’][‘location’][‘country’]=’Sri Lanka’
default[‘cms’][‘location’][‘city’]=’Colombo 02’
Now add new recipe as follows
vim cookbooks/cms/recipes/default.rb
#note “ <-
file ‘/home/damith/nodeinfo.txt’ do
content “
This system is owned by #{node[‘cms’][‘company’]},
#{node[‘cms’][‘location’][‘city’]},#{node[‘cms’][‘location’][‘country’]}
”
end
Let’s run this cookbook & look at new
content
sudo chef-client -zr “recipe[cms]”
cat ~/hostinfo.txt
#and see what is there
How override node attributes
#this is quite simple via json. See following example
vim customer.json
{
“cms”: {
“company”: “Pearson”,
“location”: {
“city”: “Colombo 09”
}
}
}
Now run recipe with customer json
sudo chef-client -zr “recipe[cms]” -j customer.json
cat ~/hostinfo.txt
#and see what is there
Let’s Add a Template!
Adding all the information into the recipe did make it hard to read.
Objectives
❑ Create a template with chef generate
❑ Define the contents of the ERB template
❑ Change the file resource to the template resource ❑ Update the cookbook's version
number
❑ Apply the updated recipe and verify the results
Let’s add new template file
#make sure to be at your $HOME
cd ~
#create new cookbooks called cms
chef generate cookbook cookbooks/cms
#now generate new recipe called default
chef generate recipe cookbooks/cms default
#Let’s create new attribute file
chef generate attribute cookbooks/cms default
#make sure to be at your $HOME
cd ~
#now generate new template called hostinfo
chef generate template cookbooks/cms hostinfo
#now check cookbook tree using
tree cookbooks/cms
What is ERB ?
An Embedded Ruby (ERB) template allows Ruby
code to be embedded inside a text file within
specially formatted tags. Ruby code can be
embedded using expressions and statements.
Learn more at : https://docs.chef.io/templates.html#variables
text within an ERB template
vi cookbooks/cms/templates/default/hostinfo.erb
~
Host Information
================
This system is owned by <%=node[‘cms’][‘company’]%>,
<%=node[‘cms’][‘location’][‘city’]%>,<%=node[‘cms’][‘location’][‘country
’]%>
Using Template on Recipe
vim cookbooks/cms/recipes/default.rb
#note
file ‘/home/damith/nodeinfo.txt’ do
source ‘hostinfo.erb`
end
Use of templates will help us to have more cleaner
codes on recipes.
Q & A
Next Session Plan
Use of CHEF for CI/CD
Practical Session with Amazon OpsWorks
Further Support
https://training.chef.io
https://docs.chef.io
Please post all of your questions on.
https://www.facebook.com/groups/devops.lk
We are ready to help you
Thank You
Special Thanks
❏ CMS (Content Management Systems)
❏ Sanjeewa Alwis - Senior Manager Application Engineering, Pearson
❏ Hirushi Vidyaratna - Intern, Application Engineering - Pearson
❏ Chef.IO for Providing Approval to Conduct this Session

More Related Content

What's hot

Docker introduction
Docker introductionDocker introduction
Docker introductionPhuc Nguyen
 
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...Edureka!
 
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...Simplilearn
 
Docker and kubernetes_introduction
Docker and kubernetes_introductionDocker and kubernetes_introduction
Docker and kubernetes_introductionJason Hu
 
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...Edureka!
 
Docker 基礎介紹與實戰
Docker 基礎介紹與實戰Docker 基礎介紹與實戰
Docker 基礎介紹與實戰Bo-Yi Wu
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)Gourav Varma
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerLuong Vo
 
Introduction to Docker Containers - Docker Captain
Introduction to Docker Containers - Docker CaptainIntroduction to Docker Containers - Docker Captain
Introduction to Docker Containers - Docker CaptainAjeet Singh Raina
 
GitOps is IaC done right
GitOps is IaC done rightGitOps is IaC done right
GitOps is IaC done rightChen Cheng-Wei
 
Kubernetes
KubernetesKubernetes
Kuberneteserialc_w
 
An overview of the Kubernetes architecture
An overview of the Kubernetes architectureAn overview of the Kubernetes architecture
An overview of the Kubernetes architectureIgor Sfiligoi
 
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...Edureka!
 

What's hot (20)

Docker introduction
Docker introductionDocker introduction
Docker introduction
 
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...
 
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
 
Docker Kubernetes Istio
Docker Kubernetes IstioDocker Kubernetes Istio
Docker Kubernetes Istio
 
Docker and kubernetes_introduction
Docker and kubernetes_introductionDocker and kubernetes_introduction
Docker and kubernetes_introduction
 
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Docker 基礎介紹與實戰
Docker 基礎介紹與實戰Docker 基礎介紹與實戰
Docker 基礎介紹與實戰
 
Intro to kubernetes
Intro to kubernetesIntro to kubernetes
Intro to kubernetes
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)
 
Docker Compose Explained
Docker Compose ExplainedDocker Compose Explained
Docker Compose Explained
 
Automation CICD
Automation CICDAutomation CICD
Automation CICD
 
Kubernetes Security
Kubernetes SecurityKubernetes Security
Kubernetes Security
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Introduction to Docker Containers - Docker Captain
Introduction to Docker Containers - Docker CaptainIntroduction to Docker Containers - Docker Captain
Introduction to Docker Containers - Docker Captain
 
GitOps is IaC done right
GitOps is IaC done rightGitOps is IaC done right
GitOps is IaC done right
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Terraform
TerraformTerraform
Terraform
 
An overview of the Kubernetes architecture
An overview of the Kubernetes architectureAn overview of the Kubernetes architecture
An overview of the Kubernetes architecture
 
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
 

Viewers also liked

Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Edureka!
 
Chef Delivery
Chef DeliveryChef Delivery
Chef DeliveryChef
 
Survey: Frozen Yogurt Market in India (2013)
Survey: Frozen Yogurt Market in India (2013)Survey: Frozen Yogurt Market in India (2013)
Survey: Frozen Yogurt Market in India (2013)Chef at Large
 
Compliance Automation Workshop
Compliance Automation WorkshopCompliance Automation Workshop
Compliance Automation WorkshopChef
 
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.
 
STIG Compliance and Remediation with Ansible
STIG Compliance and Remediation with AnsibleSTIG Compliance and Remediation with Ansible
STIG Compliance and Remediation with AnsibleAnsible
 
Puppet overview
Puppet overviewPuppet overview
Puppet overviewjoshbeard
 
Infrastructure Automation with Chef
Infrastructure Automation with Chef Infrastructure Automation with Chef
Infrastructure Automation with Chef REAN Cloud
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Alex S
 
Introduction to puppet
Introduction to puppetIntroduction to puppet
Introduction to puppetHabeeb Rahman
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricksbcoca
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction Robert Reiz
 
3 Steps to Expand DevOps and Automation Throughout the Enterprise
3 Steps to Expand DevOps and Automation Throughout the Enterprise3 Steps to Expand DevOps and Automation Throughout the Enterprise
3 Steps to Expand DevOps and Automation Throughout the EnterprisePuppet
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationJohn Lynch
 

Viewers also liked (16)

Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
 
Chef Delivery
Chef DeliveryChef Delivery
Chef Delivery
 
Survey: Frozen Yogurt Market in India (2013)
Survey: Frozen Yogurt Market in India (2013)Survey: Frozen Yogurt Market in India (2013)
Survey: Frozen Yogurt Market in India (2013)
 
Compliance Automation Workshop
Compliance Automation WorkshopCompliance Automation Workshop
Compliance Automation Workshop
 
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...
 
STIG Compliance and Remediation with Ansible
STIG Compliance and Remediation with AnsibleSTIG Compliance and Remediation with Ansible
STIG Compliance and Remediation with Ansible
 
Puppets
PuppetsPuppets
Puppets
 
Puppet overview
Puppet overviewPuppet overview
Puppet overview
 
Infrastructure Automation with Chef
Infrastructure Automation with Chef Infrastructure Automation with Chef
Infrastructure Automation with Chef
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015
 
Ansible
AnsibleAnsible
Ansible
 
Introduction to puppet
Introduction to puppetIntroduction to puppet
Introduction to puppet
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricks
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
3 Steps to Expand DevOps and Automation Throughout the Enterprise
3 Steps to Expand DevOps and Automation Throughout the Enterprise3 Steps to Expand DevOps and Automation Throughout the Enterprise
3 Steps to Expand DevOps and Automation Throughout the Enterprise
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 

Similar to Introduction to chef

Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | EdurekaEdureka!
 
REST Development made Easy with ColdFusion Aether
REST Development made Easy with ColdFusion AetherREST Development made Easy with ColdFusion Aether
REST Development made Easy with ColdFusion AetherPavan Kumar
 
Azure handsonlab
Azure handsonlabAzure handsonlab
Azure handsonlabChef
 
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...Amazon Web Services
 
Big Data: HBase and Big SQL self-study lab
Big Data:  HBase and Big SQL self-study lab Big Data:  HBase and Big SQL self-study lab
Big Data: HBase and Big SQL self-study lab Cynthia Saracco
 
2015 08-11-scdo-meetup
2015 08-11-scdo-meetup2015 08-11-scdo-meetup
2015 08-11-scdo-meetupSuresh Paulraj
 
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
 
DOES14: Scott Prugh, CSG - DevOps and Lean in Legacy Environments
DOES14: Scott Prugh, CSG - DevOps and Lean in Legacy EnvironmentsDOES14: Scott Prugh, CSG - DevOps and Lean in Legacy Environments
DOES14: Scott Prugh, CSG - DevOps and Lean in Legacy EnvironmentsDevOps Enterprise Summmit
 
Automating your infrastructure with Chef
Automating your infrastructure with ChefAutomating your infrastructure with Chef
Automating your infrastructure with ChefJohn Ewart
 
Google Cloud Storage | Google Cloud Platform Tutorial | Google Cloud Architec...
Google Cloud Storage | Google Cloud Platform Tutorial | Google Cloud Architec...Google Cloud Storage | Google Cloud Platform Tutorial | Google Cloud Architec...
Google Cloud Storage | Google Cloud Platform Tutorial | Google Cloud Architec...Edureka!
 
Real World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker CachingReal World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker CachingChris Love
 
We need revisions and CRAP everywhere in Drupal core
We need revisions and CRAP everywhere in Drupal coreWe need revisions and CRAP everywhere in Drupal core
We need revisions and CRAP everywhere in Drupal coreDick Olsson
 
Tailwind CSS.11.pptx
Tailwind CSS.11.pptxTailwind CSS.11.pptx
Tailwind CSS.11.pptxHarish Verma
 
What is DevOps | DevOps Introduction | DevOps Training | DevOps Tutorial | Ed...
What is DevOps | DevOps Introduction | DevOps Training | DevOps Tutorial | Ed...What is DevOps | DevOps Introduction | DevOps Training | DevOps Tutorial | Ed...
What is DevOps | DevOps Introduction | DevOps Training | DevOps Tutorial | Ed...Edureka!
 
SD DevOps Meet-up - Exploring Quadrants of DevOps Maturity
SD DevOps Meet-up - Exploring Quadrants of DevOps MaturitySD DevOps Meet-up - Exploring Quadrants of DevOps Maturity
SD DevOps Meet-up - Exploring Quadrants of DevOps MaturityBrian Dawson
 
Staging Drupal: Change Management Strategies for Drupal
Staging Drupal: Change Management Strategies for DrupalStaging Drupal: Change Management Strategies for Drupal
Staging Drupal: Change Management Strategies for DrupalErich Beyrent
 
Staging Drupal: Change Management Strategies for Drupal
Staging Drupal: Change Management Strategies for DrupalStaging Drupal: Change Management Strategies for Drupal
Staging Drupal: Change Management Strategies for DrupalErich Beyrent
 

Similar to Introduction to chef (20)

Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
 
Introduction to chef
Introduction to chefIntroduction to chef
Introduction to chef
 
REST Development made Easy with ColdFusion Aether
REST Development made Easy with ColdFusion AetherREST Development made Easy with ColdFusion Aether
REST Development made Easy with ColdFusion Aether
 
Azure handsonlab
Azure handsonlabAzure handsonlab
Azure handsonlab
 
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...
 
Big Data: HBase and Big SQL self-study lab
Big Data:  HBase and Big SQL self-study lab Big Data:  HBase and Big SQL self-study lab
Big Data: HBase and Big SQL self-study lab
 
2015 08-11-scdo-meetup
2015 08-11-scdo-meetup2015 08-11-scdo-meetup
2015 08-11-scdo-meetup
 
Student record
Student recordStudent record
Student record
 
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
 
DOES14: Scott Prugh, CSG - DevOps and Lean in Legacy Environments
DOES14: Scott Prugh, CSG - DevOps and Lean in Legacy EnvironmentsDOES14: Scott Prugh, CSG - DevOps and Lean in Legacy Environments
DOES14: Scott Prugh, CSG - DevOps and Lean in Legacy Environments
 
Automating your infrastructure with Chef
Automating your infrastructure with ChefAutomating your infrastructure with Chef
Automating your infrastructure with Chef
 
Screw DevOps, Let's Talk DataOps
Screw DevOps, Let's Talk DataOpsScrew DevOps, Let's Talk DataOps
Screw DevOps, Let's Talk DataOps
 
Google Cloud Storage | Google Cloud Platform Tutorial | Google Cloud Architec...
Google Cloud Storage | Google Cloud Platform Tutorial | Google Cloud Architec...Google Cloud Storage | Google Cloud Platform Tutorial | Google Cloud Architec...
Google Cloud Storage | Google Cloud Platform Tutorial | Google Cloud Architec...
 
Real World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker CachingReal World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker Caching
 
We need revisions and CRAP everywhere in Drupal core
We need revisions and CRAP everywhere in Drupal coreWe need revisions and CRAP everywhere in Drupal core
We need revisions and CRAP everywhere in Drupal core
 
Tailwind CSS.11.pptx
Tailwind CSS.11.pptxTailwind CSS.11.pptx
Tailwind CSS.11.pptx
 
What is DevOps | DevOps Introduction | DevOps Training | DevOps Tutorial | Ed...
What is DevOps | DevOps Introduction | DevOps Training | DevOps Tutorial | Ed...What is DevOps | DevOps Introduction | DevOps Training | DevOps Tutorial | Ed...
What is DevOps | DevOps Introduction | DevOps Training | DevOps Tutorial | Ed...
 
SD DevOps Meet-up - Exploring Quadrants of DevOps Maturity
SD DevOps Meet-up - Exploring Quadrants of DevOps MaturitySD DevOps Meet-up - Exploring Quadrants of DevOps Maturity
SD DevOps Meet-up - Exploring Quadrants of DevOps Maturity
 
Staging Drupal: Change Management Strategies for Drupal
Staging Drupal: Change Management Strategies for DrupalStaging Drupal: Change Management Strategies for Drupal
Staging Drupal: Change Management Strategies for Drupal
 
Staging Drupal: Change Management Strategies for Drupal
Staging Drupal: Change Management Strategies for DrupalStaging Drupal: Change Management Strategies for Drupal
Staging Drupal: Change Management Strategies for Drupal
 

Recently uploaded

VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 

Recently uploaded (20)

VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 

Introduction to chef

  • 1. INTRODUCTION TO CHEF – BY DAMITH KOTHALAWALA ,MBCS Content Acknowledgement Most of the internal content are from https://docs.chef.io CHEF™ logo is a registered trademark of Chef.io Please do not copy/redistribute without taking prior permission from chef.io
  • 2. About Me I am Damith Rushika Kothalawala and I work for Pearson as a Technical Specialist. (Application Solutions Engineering) I currently owns Basic Chef Fluency Badge from CHEF Certification + 4 other Certifications from different vendors. Find more about me @: https://www.linkedin.com/in/damithkothalawala/
  • 3. Official Approval from CHEF.io (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 4. What is Chef Chef is an open-source systems management and cloud infrastructure automation framework created by Opscode. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 5. Why named as Chef ?? (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 6. Traditional Chef 1. Chef creates new recipes after undergoing several experimenting with food. 2. Chef has a book with his favorite recipes, which is called a “Cook Book” 3. One Chef can have many “Cook Books” which contains various types of food. ❖ Chinese Food Cookbook ❖ Cookbook of Soups ❖ Cookbook of Sauces ❖ Traditional Sri Lankan Cuisine Cookbook 4. There can be relationships between two Cookbooks when its comes to food preparation ❖ Chef may have to refer one recipe of Cookbook of Sauces when making a soup from Cookbook of Soups ➢ Ex. Sometimes you need Soya Sauce to prepare a “Tom Yum” Soup. 5. Chef needs a Kitchen & Knife to do his preparation of food. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 7. So what is the similarity ? OpsCode’s Chef does the same as a traditional Chef in theory, but OpsCode chef is for the system/infra automation. Thinking about OpsCode’s chef this way will help you to understand its use well. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 8. (C) DAMITH RUSHIKA KOTHALAWALA 2017 Let's discuss about CI/CD & DevOps
  • 9. CI/CD Continuous Delivery (CD) is the practice of using automation to produce releasable software in short iterations, allowing teams to ship working software more frequently. The recent emphasis on continuous integration, built-in testing, constant monitoring, and analytics feedback all point towards an overall trend in the software industry: increasing the ability to react. As organizations explore what these changes mean for them, they invariably discover continuous delivery which is commonly known as CD. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 10. DevOPS DevOps (a clipped compound of "software DEVelopment" and "information technology OPerationS") is a term used to refer to a set of practices that emphasize the collaboration and communication of both software developers and information technology (IT) professionals while automating the process of software delivery and infrastructure changes – Wikipedia (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 11. Let's go back to … (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 12. A Single Practical activity is better than 1000 words.. Let’s start learning by doing it ;-) (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 13. Download ChefDK (Development Kit) Please navigate to https://downloads.chef.io/chefdk then download relevant installer for your OS (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 14. Let’s verify your installation (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 15. Let’s write recipes As in ordinary cooking, you may have to do some R&D before you write a perfect recipe for your cookbook. Let's start by writing one. Something to know before We Start o Chef software itself is written using a programming language called Ruby o But you do not need to know about ruby to start working with chef o Knowledge about a single programming language would be enough to work with Chef’s recipe files. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 16. hello.rb (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 17. Let’s run hello.rb recipe (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 18. Let’s review what we have done We have just created “File Resource” called /tmp/hello.txt using chef What is a Resource?? (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 19. Resource A resource is a statement of configuration policy. It describes the desired state of an element of your infrastructure and the steps needed to bring that item to the desired state. Source https://docs.chef.io/resources.html As you know, anything is a file on Anything on a system is a Resource for (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 20. Resource Definition (C) DAMITH RUSHIKA KOTHALAWALA 2017 file ‘/tmp/hello.txt' do content 'Hello, world!' end The TYPE named NAME should be ACTION'd with PROPERTIES
  • 21. Example Resources (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 22. What is chef-client chef-client is an agent that runs locally on every node that is under the management of Chef. When a chef-client runs, it will perform all of the steps that is required to bring the node into the expected state. Source: https://docs.chef.io/chef_client.html (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 23. --local-mode (or -z) chef-client's default mode attempts to contact a Chef Server and ask for the recipes to run for the given node. We override the behavior in order to have it work in the local mode. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 24. Recap: Apply the hello Recipe (C) DAMITH RUSHIKA KOTHALAWALA 2017 What would happen if the 'hello.txt' file contents were modified?
  • 25. Test and Repair (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 26. (C) DAMITH RUSHIKA KOTHALAWALA 2017 What would happen if the file • permissions (mode) • Owner • or group changed? Have we define a policy for these properties?
  • 27. chef-client’s work on Test & Repair (C) DAMITH RUSHIKA KOTHALAWALA 2017 chef-client takes an action only when it needs to. Think of it as test and repair. Chef looks at the current state of each resource and takes an action only when that resource is out of policy.
  • 28. Let’s change properties of hello.txt 1. Read https://docs.chef.io/resources.html 2. Discover the file resource's: ◦ default action. ◦ default values for mode, owner, and group. 3. Update the file policy in "hello.rb" to: The file named 'hello.txt' should be created with the content 'Hello, world!', mode '0644', owner is 'root', and group is 'root'. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 29. New hello.rb file (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 30. Learn more on resources. Likewise you can do many things with recipes when it comes to a real deployment. So please try to refer chef’s documentation and make some changes on your local system. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 31. Traditional Cookbook As discussed, a real world cookbook is a collection of recipes which can be 1. An Independent recipe ❑ ex. Steamed Rice Recipe 2. Related to one or more recipes on same cookbook ❑ ex. Fried Rice Recipe (You need streamed rice 1st to make fried rice) 3. Related to one or more recipes on some other Cookbooks ❑ ex. Chinese Chopsuey Rice (You need. Multiple recipes from many cookbooks if you make it without using market products) (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 32. (C) DAMITH RUSHIKA KOTHALAWALA 2017 HUNGRY?
  • 33. OpsCode’s Chef Cookbook A Chef cookbook is the fundamental unit of configuration and policy distribution. Each cookbook defines a scenario, such as everything needed to install and configure MySQL, and then it contains all of the components that are required to support that scenario. Read the first three paragraphs here: http://docs.chef.io/cookbooks.html (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 34. Cookbook ❑Recipes that specify the resources to use and the order in which they are to be applied ❑ Attribute values ❑ File distributions ❑ Templates ❑ Extensions to Chef, such as libraries, definitions, and custom resources ❑ Version Control (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 35. Common Components of Cookbooks 1. README 2. metadata 3. Recipes 4. testing directories (spec + test) (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 36. Let’s start with cookbook creation (C) DAMITH RUSHIKA KOTHALAWALA 2017 Acknowledgement: This section is entirely copied from a chef.io training
  • 37. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 38. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 39. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 40. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 41. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 42. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 43. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 44. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 45. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 46. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 47. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 48. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 49. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 50. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 51. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 52. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 53. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 54. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 55. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 56. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 57. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 58. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 59. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 60. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 61. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 62. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 63. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 64. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 65. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 66. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 67. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 68. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 69. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 70. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 71. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 72. (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 73. (C) DAMITH RUSHIKA KOTHALAWALA 2017 Let’s Come Back to Food
  • 75. Most of the Recipes Cannot be Customized on the fly This one serves only 4. What happen if you want to make it for 2 or 10 ? But what if that recipe got an option to customize as per your requirement ? And adjust the recipe as per those variables Ex. Please Enter Number of Servings You need 5 baking potatoes (C) DAMITH RUSHIKA KOTHALAWALA 2017 5
  • 76. Let’s Learn About Chef Node Attributes (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 77. Node Attribute Definition An attribute is a specific detail about a node. Attributes are used by the chef-client to understand: ❑The current state of the node ❑What the state of the node was at the end of the previous chef-client run ❑What the state of the node should be at the end of the current chef-client run Attributes are defined by: ❑The state of the node itself ❑Cookbooks (in attribute files and/or recipes) ❑Roles ❑Environments (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 78. Ohai Ohai is a tool that is used to detect attributes on a node, and then provide these attributes to the chef-client at the start of every chef-client run (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 80. Details provided by ohai Ohai will gather almost everything about your system and present its collected data in JSON format. Let's get some selected detail output ohai memory/total ohai memory/free ohai cpu ohai ipaddress And etc… (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 81. Let’s check node variables (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 82. Let’s check node variables (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 83. Let’s check node variables (C) DAMITH RUSHIKA KOTHALAWALA 2017
  • 84. Sometimes we may need to customize any given installation/configuration based on the type of your development/deployment or installation requirements. Examples. 1. Customized installation of a company developed software 2. Configuration files that should be updated on each new application deployment. (C) DAMITH RUSHIKA KOTHALAWALA 2017 Cookbook specific node attributes
  • 85. Let’s try with a new Cookbook (C) DAMITH RUSHIKA KOTHALAWALA 2017 #make sure to be at your $HOME cd ~ #create new cookbooks called cms chef generate cookbook cookbooks/cms #now generate new recipe called default chef generate recipe cookbooks/cms default #Let’s create new attribute file chef generate attribute cookbooks/cms default
  • 86. Let’s declare some node variables vim cookbooks/cms/attributes/default.rb #Normally we define cookbook specific node variables in following way #default[‘cookbookname’][‘var1’]=’value’ default[‘cms’][‘company`]=’cms’ default[‘cms’][‘location’][‘country’]=’Sri Lanka’ default[‘cms’][‘location’][‘city’]=’Colombo 02’
  • 87. Now add new recipe as follows vim cookbooks/cms/recipes/default.rb #note “ <- file ‘/home/damith/nodeinfo.txt’ do content “ This system is owned by #{node[‘cms’][‘company’]}, #{node[‘cms’][‘location’][‘city’]},#{node[‘cms’][‘location’][‘country’]} ” end
  • 88. Let’s run this cookbook & look at new content sudo chef-client -zr “recipe[cms]” cat ~/hostinfo.txt #and see what is there
  • 89. How override node attributes #this is quite simple via json. See following example vim customer.json { “cms”: { “company”: “Pearson”, “location”: { “city”: “Colombo 09” } } }
  • 90. Now run recipe with customer json sudo chef-client -zr “recipe[cms]” -j customer.json cat ~/hostinfo.txt #and see what is there
  • 91. Let’s Add a Template! Adding all the information into the recipe did make it hard to read. Objectives ❑ Create a template with chef generate ❑ Define the contents of the ERB template ❑ Change the file resource to the template resource ❑ Update the cookbook's version number ❑ Apply the updated recipe and verify the results
  • 92. Let’s add new template file #make sure to be at your $HOME cd ~ #create new cookbooks called cms chef generate cookbook cookbooks/cms #now generate new recipe called default chef generate recipe cookbooks/cms default #Let’s create new attribute file chef generate attribute cookbooks/cms default #make sure to be at your $HOME cd ~ #now generate new template called hostinfo chef generate template cookbooks/cms hostinfo #now check cookbook tree using tree cookbooks/cms
  • 93. What is ERB ? An Embedded Ruby (ERB) template allows Ruby code to be embedded inside a text file within specially formatted tags. Ruby code can be embedded using expressions and statements. Learn more at : https://docs.chef.io/templates.html#variables
  • 94. text within an ERB template vi cookbooks/cms/templates/default/hostinfo.erb ~ Host Information ================ This system is owned by <%=node[‘cms’][‘company’]%>, <%=node[‘cms’][‘location’][‘city’]%>,<%=node[‘cms’][‘location’][‘country ’]%>
  • 95. Using Template on Recipe vim cookbooks/cms/recipes/default.rb #note file ‘/home/damith/nodeinfo.txt’ do source ‘hostinfo.erb` end Use of templates will help us to have more cleaner codes on recipes.
  • 96. Q & A
  • 97. Next Session Plan Use of CHEF for CI/CD Practical Session with Amazon OpsWorks
  • 98. Further Support https://training.chef.io https://docs.chef.io Please post all of your questions on. https://www.facebook.com/groups/devops.lk We are ready to help you
  • 99. Thank You Special Thanks ❏ CMS (Content Management Systems) ❏ Sanjeewa Alwis - Senior Manager Application Engineering, Pearson ❏ Hirushi Vidyaratna - Intern, Application Engineering - Pearson ❏ Chef.IO for Providing Approval to Conduct this Session