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

More Decks by Jacob Mather

Other Decks in Technology


  1. Virtualize  your  stack  with   Vagrant  and  Puppet   Jacob

     Mather   So;ware  Engineer,  Mashery  
  2. What  is  Vagrant?   A  tool  that  allows  you  to

     create  and  configure   lightweight,  reproducible,  and  portable   development  environments.  
  3. How  to  use  Vagrant   •  Install  Vagrant  (hKp://vagrantup.com)  

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

     is  the  base  image   •  Guest  –  Refers  to  an  individual  vm  
  5. 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”  
  6. 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  
  7. 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  
  8. Basic  VagranVile   Vagrant.configure("2")  do  |config|      config.vm.box  =

     "base-­‐box-­‐name"        config.vm.box_url  =  ”hKp://some/url.box"   end  
  9. 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  
  10. 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  
  11. Basic  MulY-­‐Guest  VagranVile   nodes  =  {      

         :'webserver'  =>  {          :hostname  =>  'server.example.com',          :ipaddress  =>  '',      },      :'dbserver'  =>  {          :hostname  =>  'db.example.com',          :ipaddress  =>  '',      }   }  
  12. 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    
  13. 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.  
  14. Vagrant  Provisioning   •  Shell  Scripts   •  Ansible  

    •  Chef  (Solo  and  Client)   •  Puppet  (Apply  and  Agent)  
  15. 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.  
  16. 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.  
  17. Puppet  is  built…   •  To  be  simple   • 

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

    Modules  –  Abstracted  manifests   •  Templates  –  Exactly  as  it  sounds   •  Facter  –  Variable  manager   •  Hiera  –  ConfiguraYon  management  
  19. 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    
  20. 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  
  21. 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.  
  22. Thank  you!   More  informaYon  can  be  found  at: