Slide 1

Slide 1 text

Virtualize  your  stack  with   Vagrant  and  Puppet   Jacob  Mather   So;ware  Engineer,  Mashery  

Slide 2

Slide 2 text

Vagrant  

Slide 3

Slide 3 text

What  is  Vagrant?   A  tool  that  allows  you  to  create  and  configure   lightweight,  reproducible,  and  portable   development  environments.  

Slide 4

Slide 4 text

Vagrant  is  built…   •  To  be  simple   •  In  Ruby  

Slide 5

Slide 5 text

How  to  use  Vagrant   •  Install  Vagrant  (hKp://vagrantup.com)   •  Check  out  your  repository   •  Run:  vagrant  up  

Slide 6

Slide 6 text

Vagrant  Terms   •  Box  –  Also  called  base  box,  is  the  base  image   •  Guest  –  Refers  to  an  individual  vm  

Slide 7

Slide 7 text

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”  

Slide 8

Slide 8 text

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  

Slide 9

Slide 9 text

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  

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

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  

Slide 12

Slide 12 text

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  

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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    

Slide 15

Slide 15 text

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.  

Slide 16

Slide 16 text

Vagrant  Provisioning   •  Shell  Scripts   •  Ansible   •  Chef  (Solo  and  Client)   •  Puppet  (Apply  and  Agent)  

Slide 17

Slide 17 text

Puppet  

Slide 18

Slide 18 text

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.  

Slide 19

Slide 19 text

I  have  no  idea  what  that  means.  

Slide 20

Slide 20 text

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.  

Slide 21

Slide 21 text

Puppet  is  built…   •  To  be  simple   •  With  it’s  own  configuraYon  language  

Slide 22

Slide 22 text

Puppet  Terms   •  Manifests  –  EssenYally  instrucYons   •  Modules  –  Abstracted  manifests   •  Templates  –  Exactly  as  it  sounds   •  Facter  –  Variable  manager   •  Hiera  –  ConfiguraYon  management  

Slide 23

Slide 23 text

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    

Slide 24

Slide 24 text

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  

Slide 25

Slide 25 text

Vagrant  and  Puppet  

Slide 26

Slide 26 text

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.  

Slide 27

Slide 27 text

Thank  you!   More  informaYon  can  be  found  at:     hKp://jmather.com/talks/2013-­‐05-­‐25