SlideShare ist ein Scribd-Unternehmen logo
1 von 32
DevOps & Stuff
Chris Jimenez
DevOps?
DevOps (a clipped compound of "development" and "operations")
Its a culture, movement or practice that emphasizes the collaboration and
communication of both software developers and other information-technology
(IT) professionals while automating the process of software delivery and
infrastructure changes.
DevOps
“It aims at establishing a culture and environment where
building, testing, and releasing software, can happen rapidly,
frequently, and more reliably.”
DevOps
Code – Code Development and Review, continuous integration tools
Build – Version control tools, code merging, Build status
Test – Test and results determine performance
Package – Artifact repository, Application pre-deployment staging
Release – Change management, Release approvals, release automation
Configure – Infrastructure configuration and management, Infrastructure as
Code tools
Monitor – Applications performance monitoring, End user experience
DevOps
Chef
INFRASTRUCTURE : Save time and reduce errors by automating provisioning and configuration at scale
APPLICATIONS: Continuously deliver applications faster and safer with a proven pipeline
COMPLIANCE : Automate testing for security and compliance, and add remediation to your pipeline
ONE PLATFORM: CHEF : Manage changes to apps, infrastructure, and compliance in multiple environments
Es un chuzo!
Infrastructure
Let's create a Recipe
mkdir ~/chef-repo
cd ~/chef-repo
Create a MOTD file
vim hello.rb
file '/tmp/motd' do
content 'hello world'
end
Let's configure a resource
chef-client --local-mode hello.rb
Converging 1 resourcesRecipe: @recipe_files::/root/chef-repo/hello.rb * file[/tmp/motd] action create - create
new file /tmp/motd - update content in file /tmp/motd from none to b94d27 --- /tmp/motd 2016-01-07
18:10:44.638360163 +0000 +++ /tmp/.motd20160107-5972-h0sawb 2016-01-07 18:10:44.638360163 +0000 @@ -1 +1,2
@@ +hello world
Running handlers:
Running handlers complete
Chef Client finished, 1/1 resources updated in 01 seconds
more /tmp/motd
hello world
Run the command again
chef-client --local-mode hello.rb
Running handlers:
Running handlers complete
Chef Client finished, 0/1 resources updated in 01 seconds
Delete the file
file '/tmp/motd' do
action :delete
end
chef-client --local-mode goodbye.rb
Recipe: @recipe_files::/root/chef-repo/goodbye.rb
* file[/tmp/motd] action delete
- delete file /tmp/motd
Running handlers:
Running handlers complete
Chef Client finished, 1/1 resources updated in 01 seconds
Lets install Apache
vim webserver.rb
package 'apache2'
sudo chef-client --local-mode webserver.rb
Recipe: @recipe_files::/root/chef-repo/webserver.rb
apt_package[apache2] action install
- install version 2.4.7-1ubuntu4.8 of package apache2
Chef Client finished, 1/1 resources updated in 08 seconds
Run a second time
sudo chef-client --local-mode webserver.rb
* apt_package[apache2] action install (up to date)
Chef Client finished, 0/1 resources updated in 01 seconds
Start & Enable Apache
package 'apache2'
service 'apache2' do
supports :status => true
action [:enable, :start]
end
Add a home page
package 'apache2'
service 'apache2' do
supports :status => true
action [:enable, :start]
end
file '/var/www/html/index.html' do
content '<html>
<body>
<h1>hello world</h1>
</body>
</html>'
end
Hello World
Cookbooks
Make our recipes manageable
mkdir cookbook
cd cookbooks
chef generate cookbook learn_chef_apache2
This generates all the folder structure with test folders, specs, templates, and the
recipes folders
Update the recipe with a template
package 'apache2'
service 'apache2' do
supports :status => true
action [:enable, :start]
end
template '/var/www/html/index.html' do
source 'index.html.erb'
end
sudo chef-client --local-mode --runlist 'recipe[learn_chef_apache2]'
Manage your nodes
Chef Server
Acts as a central repository for your cookbooks as well as for information about every node it manages.
For example, the Chef server knows a node's fully qualified domain name (FQDN) and its platform.
Self Hosted
Hosted Chef Server
Upload a Cookbook
cd ~/learn-chef
mkdir cookbooks
knife cookbook site download learn_chef_apache2
knife cookbook upload learn_chef_apache2
Uploading learn_chef_apache2 [0.2.1]
Uploaded 1 cookbook.
Cookbooks
knife cookbook list
learn_chef_apache2 0.2.1
Bootstrap a Node
knife bootstrap ADDRESS --ssh-user USER --sudo --identity-file IDENTITY_FILE --node-name node1 --run-list
'recipe[learn_chef_apache2]'
Creating new client for node1
Creating new node for node1
Connecting to 52.33.228.36
52.33.228.36 Chef Client finished, 2/4 resources updated in 15 seconds
Chef Server
Chef Server
Update Cookbook
knife cookbook upload learn_chef_apache2
knife ssh ADDRESS 'sudo chef-client' --manual-list --ssh-user USER --identity-file IDENTITY_FILE
Clean Up
knife node delete node1 --yes
Deleted node[node1]
Develop Locally
Test Kitchen
Kitchen Life
References

Weitere ähnliche Inhalte

Was ist angesagt?

Powerful and flexible templates with Twig
Powerful and flexible templates with Twig Powerful and flexible templates with Twig
Powerful and flexible templates with Twig
Michael Peacock
 
PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2
Graham Dumpleton
 
The Best (and Worst) of Django
The Best (and Worst) of DjangoThe Best (and Worst) of Django
The Best (and Worst) of Django
Jacob Kaplan-Moss
 
Apache Hadoop India Summit 2011 talk "Oozie - Workflow for Hadoop" by Andreas N
Apache Hadoop India Summit 2011 talk "Oozie - Workflow for Hadoop" by Andreas NApache Hadoop India Summit 2011 talk "Oozie - Workflow for Hadoop" by Andreas N
Apache Hadoop India Summit 2011 talk "Oozie - Workflow for Hadoop" by Andreas N
Yahoo Developer Network
 
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
Graham Dumpleton
 
Automated release management with team city & octopusdeploy - NDC 2013
Automated release management with team city & octopusdeploy - NDC 2013Automated release management with team city & octopusdeploy - NDC 2013
Automated release management with team city & octopusdeploy - NDC 2013
Kristoffer Deinoff
 

Was ist angesagt? (20)

Zendcon 09
Zendcon 09Zendcon 09
Zendcon 09
 
Powerful and flexible templates with Twig
Powerful and flexible templates with Twig Powerful and flexible templates with Twig
Powerful and flexible templates with Twig
 
Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"
 
Getting Started-with-Laravel
Getting Started-with-LaravelGetting Started-with-Laravel
Getting Started-with-Laravel
 
Design & Performance - Steve Souders at Fastly Altitude 2015
Design & Performance - Steve Souders at Fastly Altitude 2015Design & Performance - Steve Souders at Fastly Altitude 2015
Design & Performance - Steve Souders at Fastly Altitude 2015
 
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
 
PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2
 
The Best (and Worst) of Django
The Best (and Worst) of DjangoThe Best (and Worst) of Django
The Best (and Worst) of Django
 
Codified PostgreSQL Schema
Codified PostgreSQL SchemaCodified PostgreSQL Schema
Codified PostgreSQL Schema
 
Apache Hadoop India Summit 2011 talk "Oozie - Workflow for Hadoop" by Andreas N
Apache Hadoop India Summit 2011 talk "Oozie - Workflow for Hadoop" by Andreas NApache Hadoop India Summit 2011 talk "Oozie - Workflow for Hadoop" by Andreas N
Apache Hadoop India Summit 2011 talk "Oozie - Workflow for Hadoop" by Andreas N
 
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmus
 
Apache Hive Hook
Apache Hive HookApache Hive Hook
Apache Hive Hook
 
Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.
 
Automated release management with team city & octopusdeploy - NDC 2013
Automated release management with team city & octopusdeploy - NDC 2013Automated release management with team city & octopusdeploy - NDC 2013
Automated release management with team city & octopusdeploy - NDC 2013
 
Hacking ansible
Hacking ansibleHacking ansible
Hacking ansible
 
Autoscaling with hashi_corp_nomad
Autoscaling with hashi_corp_nomadAutoscaling with hashi_corp_nomad
Autoscaling with hashi_corp_nomad
 
Integrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteIntegrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suite
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stack
 
Choosing a Javascript Framework
Choosing a Javascript FrameworkChoosing a Javascript Framework
Choosing a Javascript Framework
 

Andere mochten auch (12)

Deferred object
Deferred objectDeferred object
Deferred object
 
The Internet own boy
The Internet own boyThe Internet own boy
The Internet own boy
 
iOS 7
iOS 7 iOS 7
iOS 7
 
Unit testing
Unit testingUnit testing
Unit testing
 
An introduction to Mobile Development (Spanish)
An introduction to Mobile Development (Spanish)An introduction to Mobile Development (Spanish)
An introduction to Mobile Development (Spanish)
 
WWDC 2014
WWDC 2014WWDC 2014
WWDC 2014
 
Indoor Positioning System with iBeacons
Indoor Positioning System with iBeaconsIndoor Positioning System with iBeacons
Indoor Positioning System with iBeacons
 
REST with Eve and Python
REST with Eve and PythonREST with Eve and Python
REST with Eve and Python
 
WWDC 2016
WWDC 2016WWDC 2016
WWDC 2016
 
Mobile architecture problems and solutions.
Mobile architecture problems and solutions.Mobile architecture problems and solutions.
Mobile architecture problems and solutions.
 
Hooked - How to build habit forming products
Hooked - How to build habit forming products Hooked - How to build habit forming products
Hooked - How to build habit forming products
 
Rest Introduction (Chris Jimenez)
Rest Introduction (Chris Jimenez)Rest Introduction (Chris Jimenez)
Rest Introduction (Chris Jimenez)
 

Ähnlich wie DevOps and Chef

Muraliupdatedpersona150716
Muraliupdatedpersona150716Muraliupdatedpersona150716
Muraliupdatedpersona150716
Murali Krishna R
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
Dmitry Buzdin
 

Ähnlich wie DevOps and Chef (20)

Azure handsonlab
Azure handsonlabAzure handsonlab
Azure handsonlab
 
Treat your servers like your Ruby App: Infrastructure as Code
Treat your servers like your Ruby App: Infrastructure as CodeTreat your servers like your Ruby App: Infrastructure as Code
Treat your servers like your Ruby App: Infrastructure as Code
 
Anatomy of a Build Pipeline
Anatomy of a Build PipelineAnatomy of a Build Pipeline
Anatomy of a Build Pipeline
 
Environment
EnvironmentEnvironment
Environment
 
Muraliupdatedpersona150716
Muraliupdatedpersona150716Muraliupdatedpersona150716
Muraliupdatedpersona150716
 
DevSec Delight with Compliance as Code - Matt Ray - AgileNZ 2017
DevSec Delight with Compliance as Code - Matt Ray - AgileNZ 2017DevSec Delight with Compliance as Code - Matt Ray - AgileNZ 2017
DevSec Delight with Compliance as Code - Matt Ray - AgileNZ 2017
 
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
DevOpsDays Singapore - Continuous Auditing with Compliance as CodeDevOpsDays Singapore - Continuous Auditing with Compliance as Code
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
 
Twelve-Factor App: Software Application Architecture
Twelve-Factor App: Software Application ArchitectureTwelve-Factor App: Software Application Architecture
Twelve-Factor App: Software Application Architecture
 
Automating AWS Compliance with InSpec
Automating AWS Compliance with InSpec Automating AWS Compliance with InSpec
Automating AWS Compliance with InSpec
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Introduction to chef
Introduction to chefIntroduction to chef
Introduction to chef
 
Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015
 
Devops
DevopsDevops
Devops
 
Automating Compliance with InSpec - AWS North Sydney
Automating Compliance with InSpec - AWS North SydneyAutomating Compliance with InSpec - AWS North Sydney
Automating Compliance with InSpec - AWS North Sydney
 
Deployer - Deployment tool for PHP
Deployer - Deployment tool for PHPDeployer - Deployment tool for PHP
Deployer - Deployment tool for PHP
 
Achieving DevOps Success with Chef Automate
Achieving DevOps Success with Chef AutomateAchieving DevOps Success with Chef Automate
Achieving DevOps Success with Chef Automate
 
DevOps and Chef improve your life
DevOps and Chef improve your life DevOps and Chef improve your life
DevOps and Chef improve your life
 
Automating your infrastructure with Chef
Automating your infrastructure with ChefAutomating your infrastructure with Chef
Automating your infrastructure with Chef
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
Bay Area Chef Meetup February
Bay Area Chef Meetup FebruaryBay Area Chef Meetup February
Bay Area Chef Meetup February
 

Kürzlich hochgeladen

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Kürzlich hochgeladen (20)

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 

DevOps and Chef

  • 2. DevOps? DevOps (a clipped compound of "development" and "operations") Its a culture, movement or practice that emphasizes the collaboration and communication of both software developers and other information-technology (IT) professionals while automating the process of software delivery and infrastructure changes.
  • 3. DevOps “It aims at establishing a culture and environment where building, testing, and releasing software, can happen rapidly, frequently, and more reliably.”
  • 4. DevOps Code – Code Development and Review, continuous integration tools Build – Version control tools, code merging, Build status Test – Test and results determine performance Package – Artifact repository, Application pre-deployment staging Release – Change management, Release approvals, release automation Configure – Infrastructure configuration and management, Infrastructure as Code tools Monitor – Applications performance monitoring, End user experience
  • 6.
  • 7. Chef INFRASTRUCTURE : Save time and reduce errors by automating provisioning and configuration at scale APPLICATIONS: Continuously deliver applications faster and safer with a proven pipeline COMPLIANCE : Automate testing for security and compliance, and add remediation to your pipeline ONE PLATFORM: CHEF : Manage changes to apps, infrastructure, and compliance in multiple environments Es un chuzo!
  • 9. Let's create a Recipe mkdir ~/chef-repo cd ~/chef-repo Create a MOTD file vim hello.rb file '/tmp/motd' do content 'hello world' end
  • 10. Let's configure a resource chef-client --local-mode hello.rb Converging 1 resourcesRecipe: @recipe_files::/root/chef-repo/hello.rb * file[/tmp/motd] action create - create new file /tmp/motd - update content in file /tmp/motd from none to b94d27 --- /tmp/motd 2016-01-07 18:10:44.638360163 +0000 +++ /tmp/.motd20160107-5972-h0sawb 2016-01-07 18:10:44.638360163 +0000 @@ -1 +1,2 @@ +hello world Running handlers: Running handlers complete Chef Client finished, 1/1 resources updated in 01 seconds more /tmp/motd hello world
  • 11. Run the command again chef-client --local-mode hello.rb Running handlers: Running handlers complete Chef Client finished, 0/1 resources updated in 01 seconds
  • 12. Delete the file file '/tmp/motd' do action :delete end chef-client --local-mode goodbye.rb Recipe: @recipe_files::/root/chef-repo/goodbye.rb * file[/tmp/motd] action delete - delete file /tmp/motd Running handlers: Running handlers complete Chef Client finished, 1/1 resources updated in 01 seconds
  • 13. Lets install Apache vim webserver.rb package 'apache2' sudo chef-client --local-mode webserver.rb Recipe: @recipe_files::/root/chef-repo/webserver.rb apt_package[apache2] action install - install version 2.4.7-1ubuntu4.8 of package apache2 Chef Client finished, 1/1 resources updated in 08 seconds
  • 14. Run a second time sudo chef-client --local-mode webserver.rb * apt_package[apache2] action install (up to date) Chef Client finished, 0/1 resources updated in 01 seconds
  • 15. Start & Enable Apache package 'apache2' service 'apache2' do supports :status => true action [:enable, :start] end
  • 16. Add a home page package 'apache2' service 'apache2' do supports :status => true action [:enable, :start] end file '/var/www/html/index.html' do content '<html> <body> <h1>hello world</h1> </body> </html>' end
  • 18. Cookbooks Make our recipes manageable mkdir cookbook cd cookbooks chef generate cookbook learn_chef_apache2 This generates all the folder structure with test folders, specs, templates, and the recipes folders
  • 19. Update the recipe with a template package 'apache2' service 'apache2' do supports :status => true action [:enable, :start] end template '/var/www/html/index.html' do source 'index.html.erb' end sudo chef-client --local-mode --runlist 'recipe[learn_chef_apache2]'
  • 21. Chef Server Acts as a central repository for your cookbooks as well as for information about every node it manages. For example, the Chef server knows a node's fully qualified domain name (FQDN) and its platform. Self Hosted Hosted Chef Server
  • 22. Upload a Cookbook cd ~/learn-chef mkdir cookbooks knife cookbook site download learn_chef_apache2 knife cookbook upload learn_chef_apache2 Uploading learn_chef_apache2 [0.2.1] Uploaded 1 cookbook.
  • 24. Bootstrap a Node knife bootstrap ADDRESS --ssh-user USER --sudo --identity-file IDENTITY_FILE --node-name node1 --run-list 'recipe[learn_chef_apache2]' Creating new client for node1 Creating new node for node1 Connecting to 52.33.228.36 52.33.228.36 Chef Client finished, 2/4 resources updated in 15 seconds
  • 27. Update Cookbook knife cookbook upload learn_chef_apache2 knife ssh ADDRESS 'sudo chef-client' --manual-list --ssh-user USER --identity-file IDENTITY_FILE
  • 28. Clean Up knife node delete node1 --yes Deleted node[node1]