SlideShare une entreprise Scribd logo
1  sur  18
Chef & Vagrant
Automate server builds
The Old Way
● Provision Server
● Install packages
– Apt-get
– Install from source
– Perl/Bash scripts scripts
● Not very scalable
● Can't version control your servers
● Hard to fully automate
The New Way
● Provision Server
● Run Chef to configure
● Highly scalable
● Very modular
● Recipes are Ruby DSL, checked into Git
● Can be fully automated with minimal effort
Getting Started - the Parts
● VirtualBox
– Open Source virtualization software
● Chef (Solo)
– Framework for configuring servers
– Write your recipes in Ruby
● Vagrant
– virtualization wrapper for VirtualBox, VMWare, AWS, etc.
– Allows you to bootstrap with Chef (or Puppet)
Getting Started
● Download and Install:
– VirtualBox: https://www.virtualbox.org/wiki/Downloads
– Vagrant: http://downloads.vagrantup.com/
● Checkout Gazelle cookbooks:
– git clone --recursive
https://github.com/secondrotation/secondrotation_chef.git
– (Make sure you use recursive so you get the submodules)
Create the first VM
● Create an Ubuntu 12.04 server
● Install Apache2
● Install MySql server 5.5
Create new VM
● example
Key Vagrant Commands
● vangrant init – generate Vagrant configuration file
● vagrant up – start VM
● vagrant halt – stop VM
● vagrant reload – restart VM (stop, start)
● vagrant ssh – log into VM
● vagrant –help
What does Chef do?
● Allows you to describe the state of a server
● Only acts if the system reflects a different state
● Provides a generic abstraction layer with access to
key attributes (os, hardware, etc.)
● Runs actions in the order you specified (unlike
Puppet)
● Power of Ruby – arrays, looping, logic, Erb
templates, blocks, etc. - It's familiar
Install Apache, MySQL
● Back to Example
Resources
● A piece of the system and it's desired state
● Ex:
directory "/tmp/folder" do
owner "root"
group "root"
mode 0755
action :create
end
remote_file "#{Chef::Config[:file_cache_path]}/large-file.tar.gz" do
source "http://www.example.org/large-file.tar.gz"
end
package "git" do
action :install
end
More Resources
● And when all else fails:
● Full list online http://docs.opscode.com/resource.html
bash "install_something" do
user "root"
cwd "/tmp"
code <<-EOH
wget http://www.example.com/tarball.tar.gz
tar -zxf tarball.tar.gz
cd tarball
./configure
make
make install
EOH
end
Anatomy of a Cookbook
● attributes – default values
● recipes – actual steps to perform
● files – static files, usually configuration
● templates – dynamic files, unusually Erb templates
used for configuration
● definitions – custom resources specific to that
cookbook
● tests – Cucumber & MiniTest, TestKitchen
Getting Cookbooks
● Opscode: http://community.opscode.com/cookbooks
● GitHub:
– Opscode's: https://github.com/opscode-cookbooks (135)
– Other People's cookbooks: check out code before using
– Fork and give back!
Recipe Run
● Always runs recipes/default.rb
● If you've specified another recipe, run that one: for
example:
– mysql:server:
● First runs recipes/default.rb
● Then runs recipes/server.rb
● It's easy to write spaghetti code
– Refactor, refactor, refactor
More Complicated Example: ESB
● Run through the ESB setup
Final Thoughts
● Chef is not the end all, but another tool in your toolbox
● Good for system configuration documentation
● VM based approach is slow to run for a variety of reasons
– apt-get runs as a single thread
– Compiling code is generally slow
● Docker is an interesting alternative to traditional VM, but
not ready for production
Questions?

Contenu connexe

Tendances

Tendances (20)

Linux host orchestration with Foreman, Puppet and Gitlab
Linux host orchestration with Foreman, Puppet and GitlabLinux host orchestration with Foreman, Puppet and Gitlab
Linux host orchestration with Foreman, Puppet and Gitlab
 
Red Hat Satellite 6 - Automation with Puppet
Red Hat Satellite 6 - Automation with PuppetRed Hat Satellite 6 - Automation with Puppet
Red Hat Satellite 6 - Automation with Puppet
 
OpenNebula, the foreman and CentOS play nice, too
OpenNebula, the foreman and CentOS play nice, tooOpenNebula, the foreman and CentOS play nice, too
OpenNebula, the foreman and CentOS play nice, too
 
Spot Trading - A case study in continuous delivery for mission critical finan...
Spot Trading - A case study in continuous delivery for mission critical finan...Spot Trading - A case study in continuous delivery for mission critical finan...
Spot Trading - A case study in continuous delivery for mission critical finan...
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
 
SaltStack Configuration Management
SaltStack Configuration ManagementSaltStack Configuration Management
SaltStack Configuration Management
 
A quick intro to Ansible
A quick intro to AnsibleA quick intro to Ansible
A quick intro to Ansible
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environments
 
SaltConf14 - Oz Akan, Rackspace - Deploying OpenStack Marconi with SaltStack
SaltConf14 - Oz Akan, Rackspace - Deploying OpenStack Marconi with SaltStackSaltConf14 - Oz Akan, Rackspace - Deploying OpenStack Marconi with SaltStack
SaltConf14 - Oz Akan, Rackspace - Deploying OpenStack Marconi with SaltStack
 
Ansible intro
Ansible introAnsible intro
Ansible intro
 
Deploying Foreman in Enterprise Environments
Deploying Foreman in Enterprise EnvironmentsDeploying Foreman in Enterprise Environments
Deploying Foreman in Enterprise Environments
 
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
 
SaltConf14 - Saurabh Surana, HP Cloud - Automating operations and support wit...
SaltConf14 - Saurabh Surana, HP Cloud - Automating operations and support wit...SaltConf14 - Saurabh Surana, HP Cloud - Automating operations and support wit...
SaltConf14 - Saurabh Surana, HP Cloud - Automating operations and support wit...
 
Foreman presentation
Foreman presentationForeman presentation
Foreman presentation
 
Mass-Migration of 5000 Servers to Foreman/Katello with bootstrap.py - Evgeni ...
Mass-Migration of 5000 Servers to Foreman/Katello with bootstrap.py - Evgeni ...Mass-Migration of 5000 Servers to Foreman/Katello with bootstrap.py - Evgeni ...
Mass-Migration of 5000 Servers to Foreman/Katello with bootstrap.py - Evgeni ...
 
Refactoring Katello Installer modules - Ewoud Kohl van Wijngaarden
Refactoring Katello Installer modules - Ewoud Kohl van WijngaardenRefactoring Katello Installer modules - Ewoud Kohl van Wijngaarden
Refactoring Katello Installer modules - Ewoud Kohl van Wijngaarden
 
PXEless Discovery with Foreman
PXEless Discovery with ForemanPXEless Discovery with Foreman
PXEless Discovery with Foreman
 
Using SaltStack to orchestrate microservices in application containers at Sal...
Using SaltStack to orchestrate microservices in application containers at Sal...Using SaltStack to orchestrate microservices in application containers at Sal...
Using SaltStack to orchestrate microservices in application containers at Sal...
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = Code
 
Salt Stack - Subhankar Sengupta
Salt Stack - Subhankar SenguptaSalt Stack - Subhankar Sengupta
Salt Stack - Subhankar Sengupta
 

En vedette

Intoduction to VirtualBox English
Intoduction to VirtualBox EnglishIntoduction to VirtualBox English
Intoduction to VirtualBox English
Kichiemon Adachi
 
SYSAD323 Virtualization Basics
SYSAD323 Virtualization BasicsSYSAD323 Virtualization Basics
SYSAD323 Virtualization Basics
Don Bosco BSIT
 
Virtualization presentation
Virtualization presentationVirtualization presentation
Virtualization presentation
Mangesh Gunjal
 

En vedette (16)

Intoduction to VirtualBox English
Intoduction to VirtualBox EnglishIntoduction to VirtualBox English
Intoduction to VirtualBox English
 
Virtualization 101: Everything You Need To Know To Get Started With VMware
Virtualization 101: Everything You Need To Know To Get Started With VMwareVirtualization 101: Everything You Need To Know To Get Started With VMware
Virtualization 101: Everything You Need To Know To Get Started With VMware
 
Virtualization
VirtualizationVirtualization
Virtualization
 
Hands on Virtualization with Ganeti
Hands on Virtualization with GanetiHands on Virtualization with Ganeti
Hands on Virtualization with Ganeti
 
Kvm
KvmKvm
Kvm
 
VirtualBox
VirtualBoxVirtualBox
VirtualBox
 
SYSAD323 Virtualization Basics
SYSAD323 Virtualization BasicsSYSAD323 Virtualization Basics
SYSAD323 Virtualization Basics
 
Virtualbox
VirtualboxVirtualbox
Virtualbox
 
Virtual Machines
Virtual MachinesVirtual Machines
Virtual Machines
 
Virtual machine
Virtual machineVirtual machine
Virtual machine
 
Virtual Box Presentation
Virtual Box Presentation Virtual Box Presentation
Virtual Box Presentation
 
Virtual machine
Virtual machineVirtual machine
Virtual machine
 
1.Introduction to virtualization
1.Introduction to virtualization1.Introduction to virtualization
1.Introduction to virtualization
 
Virtualization
VirtualizationVirtualization
Virtualization
 
Virtualization presentation
Virtualization presentationVirtualization presentation
Virtualization presentation
 
Virtualization in cloud computing ppt
Virtualization in cloud computing pptVirtualization in cloud computing ppt
Virtualization in cloud computing ppt
 

Similaire à Chef, Vagrant, and VirtualBox

Perl hosting for beginners - Cluj.pm March 2013
Perl hosting for beginners - Cluj.pm March 2013Perl hosting for beginners - Cluj.pm March 2013
Perl hosting for beginners - Cluj.pm March 2013
Arpad Szasz
 
Systems Automation with Puppet
Systems Automation with PuppetSystems Automation with Puppet
Systems Automation with Puppet
elliando dias
 
Avoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and VagrantAvoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and Vagrant
andygale
 

Similaire à Chef, Vagrant, and VirtualBox (20)

IT Automation with Chef
IT Automation with ChefIT Automation with Chef
IT Automation with Chef
 
Perl hosting for beginners - Cluj.pm March 2013
Perl hosting for beginners - Cluj.pm March 2013Perl hosting for beginners - Cluj.pm March 2013
Perl hosting for beginners - Cluj.pm March 2013
 
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...
 
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
 
Using Vagrant
Using VagrantUsing Vagrant
Using Vagrant
 
Configuration of Apache Web Server On CentOS 8
Configuration of Apache Web Server On CentOS 8Configuration of Apache Web Server On CentOS 8
Configuration of Apache Web Server On CentOS 8
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. Ansible
 
Hadoop meet Rex(How to construct hadoop cluster with rex)
Hadoop meet Rex(How to construct hadoop cluster with rex)Hadoop meet Rex(How to construct hadoop cluster with rex)
Hadoop meet Rex(How to construct hadoop cluster with rex)
 
Vagrant for Virtualized Development
Vagrant for Virtualized DevelopmentVagrant for Virtualized Development
Vagrant for Virtualized Development
 
02 Hadoop deployment and configuration
02 Hadoop deployment and configuration02 Hadoop deployment and configuration
02 Hadoop deployment and configuration
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
 
Systems Automation with Puppet
Systems Automation with PuppetSystems Automation with Puppet
Systems Automation with Puppet
 
Setting up LAMP for Linux newbies
Setting up LAMP for Linux newbiesSetting up LAMP for Linux newbies
Setting up LAMP for Linux newbies
 
A Universe From Nothing
A Universe From NothingA Universe From Nothing
A Universe From Nothing
 
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
Dev ninja  -> vagrant + virtualbox + chef-solo + git + ec2Dev ninja  -> vagrant + virtualbox + chef-solo + git + ec2
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
 
Linux advanced concepts - Part 2
Linux advanced concepts - Part 2Linux advanced concepts - Part 2
Linux advanced concepts - Part 2
 
Chef - Administration for programmers
Chef - Administration for programmersChef - Administration for programmers
Chef - Administration for programmers
 
Deploy Rails Application by Capistrano
Deploy Rails Application by CapistranoDeploy Rails Application by Capistrano
Deploy Rails Application by Capistrano
 
Cooking Perl with Chef: Hello World Tutorial
Cooking Perl with Chef: Hello World TutorialCooking Perl with Chef: Hello World Tutorial
Cooking Perl with Chef: Hello World Tutorial
 
Avoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and VagrantAvoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and Vagrant
 

Dernier

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Dernier (20)

Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 

Chef, Vagrant, and VirtualBox

  • 1. Chef & Vagrant Automate server builds
  • 2. The Old Way ● Provision Server ● Install packages – Apt-get – Install from source – Perl/Bash scripts scripts ● Not very scalable ● Can't version control your servers ● Hard to fully automate
  • 3. The New Way ● Provision Server ● Run Chef to configure ● Highly scalable ● Very modular ● Recipes are Ruby DSL, checked into Git ● Can be fully automated with minimal effort
  • 4. Getting Started - the Parts ● VirtualBox – Open Source virtualization software ● Chef (Solo) – Framework for configuring servers – Write your recipes in Ruby ● Vagrant – virtualization wrapper for VirtualBox, VMWare, AWS, etc. – Allows you to bootstrap with Chef (or Puppet)
  • 5. Getting Started ● Download and Install: – VirtualBox: https://www.virtualbox.org/wiki/Downloads – Vagrant: http://downloads.vagrantup.com/ ● Checkout Gazelle cookbooks: – git clone --recursive https://github.com/secondrotation/secondrotation_chef.git – (Make sure you use recursive so you get the submodules)
  • 6. Create the first VM ● Create an Ubuntu 12.04 server ● Install Apache2 ● Install MySql server 5.5
  • 8. Key Vagrant Commands ● vangrant init – generate Vagrant configuration file ● vagrant up – start VM ● vagrant halt – stop VM ● vagrant reload – restart VM (stop, start) ● vagrant ssh – log into VM ● vagrant –help
  • 9. What does Chef do? ● Allows you to describe the state of a server ● Only acts if the system reflects a different state ● Provides a generic abstraction layer with access to key attributes (os, hardware, etc.) ● Runs actions in the order you specified (unlike Puppet) ● Power of Ruby – arrays, looping, logic, Erb templates, blocks, etc. - It's familiar
  • 10. Install Apache, MySQL ● Back to Example
  • 11. Resources ● A piece of the system and it's desired state ● Ex: directory "/tmp/folder" do owner "root" group "root" mode 0755 action :create end remote_file "#{Chef::Config[:file_cache_path]}/large-file.tar.gz" do source "http://www.example.org/large-file.tar.gz" end package "git" do action :install end
  • 12. More Resources ● And when all else fails: ● Full list online http://docs.opscode.com/resource.html bash "install_something" do user "root" cwd "/tmp" code <<-EOH wget http://www.example.com/tarball.tar.gz tar -zxf tarball.tar.gz cd tarball ./configure make make install EOH end
  • 13. Anatomy of a Cookbook ● attributes – default values ● recipes – actual steps to perform ● files – static files, usually configuration ● templates – dynamic files, unusually Erb templates used for configuration ● definitions – custom resources specific to that cookbook ● tests – Cucumber & MiniTest, TestKitchen
  • 14. Getting Cookbooks ● Opscode: http://community.opscode.com/cookbooks ● GitHub: – Opscode's: https://github.com/opscode-cookbooks (135) – Other People's cookbooks: check out code before using – Fork and give back!
  • 15. Recipe Run ● Always runs recipes/default.rb ● If you've specified another recipe, run that one: for example: – mysql:server: ● First runs recipes/default.rb ● Then runs recipes/server.rb ● It's easy to write spaghetti code – Refactor, refactor, refactor
  • 16. More Complicated Example: ESB ● Run through the ESB setup
  • 17. Final Thoughts ● Chef is not the end all, but another tool in your toolbox ● Good for system configuration documentation ● VM based approach is slow to run for a variety of reasons – apt-get runs as a single thread – Compiling code is generally slow ● Docker is an interesting alternative to traditional VM, but not ready for production