Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Virtualize your stack with Vagrant and Puppet

Virtualize your stack with Vagrant and Puppet

An introduction to the how and why of Vagrant and Puppet.

Find out more at http://jmather.com/talks/2013-05-25/


Jacob Mather

May 25, 2013


  1. Virtualize  your  stack  with   Vagrant  and  Puppet   Jacob

     Mather   So;ware  Engineer,  Mashery  
  2. Vagrant  

  3. What  is  Vagrant?   A  tool  that  allows  you  to

     create  and  configure   lightweight,  reproducible,  and  portable   development  environments.  
  4. Vagrant  is  built…   •  To  be  simple   • 

    In  Ruby  
  5. How  to  use  Vagrant   •  Install  Vagrant  (hKp://vagrantup.com)  

    •  Check  out  your  repository   •  Run:  vagrant  up  
  6. Vagrant  Terms   •  Box  –  Also  called  base  box,

     is  the  base  image   •  Guest  –  Refers  to  an  individual  vm  
  7. Vagrant  Providers   Vagrant  can  use  a  few  different  plaVorms

     for   spinning  up  new  servers.  Currently,  they  are:     •  VirtualBox  (hKps://www.virtualbox.org/)   •  *VMware  (Fusion  and  WorkstaYon)   VagrantUp.com  pushes  for  VMware  for  “work”  
  8. Vagrant  Providers  (cont…)   •  VirtualBox  is  FREE!   – It

     works  great  except  where  it  doesn’t   •  Some  people  have  trouble  with  it  crashing   •  It  can’t  handle  a  large  number  of  files  with  the  standard   file  sharing  system   •  NFS  poses  it’s  own  complicaYons   •  Vmware  is  PAID!   – It’s  $49  or  $99  for  the  so;ware  and  $79  for  the   provider   – Supposed  to  be  more  stable  and  faster  
  9. Basic  Vagrant  Commands   •  vagrant  up  –  Turn  guest

     on   •  vagrant  halt  –  Turn  guest  off   •  vagrant  status  –  Show  guest  status   •  vagrant  destroy  –  Delete  guest   •  vagrant  suspend  –  Suspend  guest   •  vagrant  resume  –  Resume  guest   •  vagrant  ssh  –  SSH  into  guest  
  10. Basic  VagranVile   Vagrant.configure("2")  do  |config|      config.vm.box  =

     "base-­‐box-­‐name"        config.vm.box_url  =  ”hKp://some/url.box"   end  
  11. Basic  VagranVile  (with  FS)   Vagrant.configure("2")  do  |config|    

     config.vm.box  =  "base-­‐box-­‐name"        config.vm.box_url  =  ”hKp://some/url.box"      config.vm.synced_folder  "/data",  "/vagrant_data"   end  
  12. Basic  VagranVile  (and  PF)   Vagrant.configure("2")  do  |config|    

     config.vm.box  =  "base-­‐box-­‐name"      config.vm.box_url  =  "hKp://some/url.box"      config.vm.network  :forwarded_port,  guest:  80,  host:  8080      config.vm.synced_folder  "/data",  "/vagrant_data"   end  
  13. Basic  MulY-­‐Guest  VagranVile   nodes  =  {      

         :'webserver'  =>  {          :hostname  =>  'server.example.com',          :ipaddress  =>  '',      },      :'dbserver'  =>  {          :hostname  =>  'db.example.com',          :ipaddress  =>  '',      }   }  
  14. Basic  MulY-­‐Guest  VagranVile   nodes  =  {  …  node  configuraYon

     …  }   Vagrant.configure("2")  do  |config|      nodes.each_pair  do  |name,opYons|          config.vm.define  name  do  |node|              node.vm.box  =  "base-­‐box-­‐name"              node.vm.box_url  =  "hKp://some/url.box"              node.vm.hostname  =  opYons[:hostname]              node.vm.network  :private_network,  ip:  opYons[:ipaddress]          end      end   end    
  15. Vagrant  Limits   So  this  whole  spinning  up  guests  thing

     is  cool   and  all,  but  what  am  I  supposed  to  do  with  all  of   these  dumb  boxes?     “Hardware”  without  so;ware  is  nearly  useless.  
  16. Vagrant  Provisioning   •  Shell  Scripts   •  Ansible  

    •  Chef  (Solo  and  Client)   •  Puppet  (Apply  and  Agent)  
  17. Puppet  

  18. What  is  Puppet?   Puppet  is  IT  automaYon  so;ware  that

     helps   system  administrators  manage  infrastructure   throughout  its  lifecycle,  from  provisioning  and   configuraYon  to  patch  management  and   compliance.  
  19. I  have  no  idea  what  that  means.  

  20. What  is  Puppet?   Puppet  gives  you  an  “object  oriented”

     way  to   manage  the  configuraYon  of  your  servers,  either   on  your  laptop,  in  the  cloud,  or  in  your  favorite   data  center.  
  21. Puppet  is  built…   •  To  be  simple   • 

    With  it’s  own  configuraYon  language  
  22. Puppet  Terms   •  Manifests  –  EssenYally  instrucYons   • 

    Modules  –  Abstracted  manifests   •  Templates  –  Exactly  as  it  sounds   •  Facter  –  Variable  manager   •  Hiera  –  ConfiguraYon  management  
  23. How  to  use  Puppet?   Use  a  base  box  for

     Vagrant  from  Puppet  Labs     hKp://puppet-­‐vagrant-­‐boxes.puppetlabs.com/     I  like  to  use  the  CentOS  6.4  for  VirtualBox    
  24. Basic  Puppet  Powered  VagranVile   Vagrant.configure("2")  do  |config|    

     config.vm.box  =  "base-­‐box-­‐name"      config.vm.box_url  =  "hKp://some/url.box"      config.vm.provision  :puppet  do  |puppet|          puppet.manifests_path  =  "puppet/manifests/"          puppet.manifest_file    =  "guest.pp"          puppet.module_path  =  "puppet/modules/"      end   end  
  25. Vagrant  and  Puppet  

  26. Other  Resources   hKp://PuPHPet.com     PuPHPet  provides  a  

    simple  config  tool  for   those  who  don’t  want   to  Ynker  with  puppet   and  need  a  LAMP  stack   up  and  running  NOW.  
  27. Thank  you!   More  informaYon  can  be  found  at: