Vagrant + Puppet: 
deployment made easy. 
May 2014
WWhhoo?? 
Geronimo Orozco 
Cloud Engineer & Free Software developer 
@patux 
http://patux.net 
http://github.com/patux
Development Process
DDeevveellooppeerr ccoommmmoonn nniigghhttmmaarreess...... 
Have you ever worked with...
DDeevveellooppeerr ccoommmmoonn nniigghhttmmaarreess...... 
Multiple projects 
+ 
Dependencies on various kinds of software in various 
degrees of stability 
= 
YYoouurr ddeevveellooppmmeenntt mmaacchhiinnee iiss bbeeccoommiinngg ffuullll ooff ccrraapp
DDeevveellooppeerr ccoommmmoonn nniigghhttmmaarreess...... 
Multiple projects 
+ 
Dependencies on the same software but with different 
versions 
= 
YYoouurr ddeevveellooppmmeenntt mmaacchhiinnee iiss bbeeccoommiinngg ffuullll ooff ccrraapp 
((aaggaaiinn))
DDeevveellooppeerr ccoommmmoonn nniigghhttmmaarreess...... 
Existing developer with (partial and no up to date) info on 
how to reproduce a development environment 
+ 
New developer on the team (with a shiny new machine) 
= 
IIssssuueess ttoo rreepprroodduuccee tthhee ssaammee ddeevveellooppmmeenntt 
eennvviirroonnmmeenntt
DDeevveellooppeerr ccoommmmoonn nniigghhttmmaarreess...... 
Development environment 
≠ 
Production/CI environment 
= 
WWoorrkkss oonn mmyy mmaacchhiinnee!!!!!! ssyynnddrroommee
AA ddeevveellooppmmeenntt ssttoorryy...... 
IT Engineering 
Task 
Requires 
Component X 
Requires 
Component Y
AA ddeevveellooppmmeenntt ssttoorryy...... wwiitthh ssttoorryy 
ppooiinnttss 
3 88 3 
IT Engineering 
Task 
Requires 
Component X 
Requires 
Component Y 
2
AA tteeaamm ooff 66 mmeemmbbeerrss...... 
IT Engineering 
2 
3 3 
2 
3 3 
2 
3 3 
2 
3 3 
2 
3 3 
2 
3 3 4488
$ git clone git://path/to/myapp.git 
$ cd myapp 
$ magic command 
$ ssh myenvironment 
. . . hack . . .
$ git clone git://path/to/myapp.git 
$ cd myapp 
$ vagrant up 
$ ssh myenvironment 
. . . hack . . .
VVaaggrraanntt 
● Mitchel Hashimoto & John Bender 
● http://vagrantup.com 
● Based on Virtualbox, Ruby 
● Runs on MacOS, Linux, Windows 
● Supports multiple provisioners (puppet/chef/shell/powershell/Salt/Ansible/Docker) 
* Vagrant lowers development environment setup time, maximizes dev/prod parity, 
and makes the "works on my machine" excuse a relic of the past. 
Developers no longer need to worry about setting up complicated infrastructure 
components. Projects with conflicting dependencies can each get their own sandbox 
-- keeping a developer's workstation free of the hacks needed for multiple versions 
of software to coexist. 
*http://vagrantup.com
WWhhyy wwoouulldd uussee iitt?? 
● Reduces setup time (3 steps & you’re ready) 
● Simplicity (you don’t have to mess with vbox/vmware api) 
● Self-Service (You don’t have to ask for resources) 
● Consistency (Your teammate gets the same exact environment) 
● Repeatability (You can build/destroy/rebuild/shutdown as you please) 
● Contained (You don’t have to pollute your laptop and break things, get the 
development environment isolated but at the same time connected )
CCaappaabbiilliittiieess 
● Filesharing (A folder from your machine into the virtual machine) 
● Port forwarding (A port from the vm pointing to a local port) 
● Non-Intrusive (You can use your editor/ide from your machine writing into the 
shared folder) 
● Multi VM Stack 
– Not only one vm per config file 
– You can build many environments as you want only limited by your workstation/laptop 
resources
VVaaggrraanntt 
VVaaggrraannttffiillee 
– Port fortwarding 
– Synced folders 
– VM configuration 
– Network configuration 
– SSH access 
– Multiple providers 
– Multiple provisioners 
– Non intrusive
IT automation software
DDeemmoo ttiimmee!! 
$ git clone https://github.com/patux/rails-dev-box 
$ cd rails-dev-box 
$ vagrant up 
$ vagrant ssh
DDeemmoo ttiimmee!! 
$ cd /vagrant 
$ git clone https://github.com/railstutorial/sample_app.git 
$ rvm install ruby-1.8 
$ rvm use 1.8 
$ cd sample_app 
$ bundle install 
$ rake db:setup 
$ rails server
PPuuppppeett 
● DSL to describe 
your environment 
configuration 
● http://puppetlabs.com 
● http://docs.puppetlabs.com
DDeevvOOppss && VVaaggrraanntt ccoommmmuunniittyy 
• Chef & Puppet Friendly (Puppet standalone/server, Chef solo/server) 
– We can create/reuse puppet modules or chef recipes 
● Integrate to the cloud environment with minor tweaks 
• Recipes across internet (Just google it: vagrant+project) 
• http://vagrantbox.es 
– You don’t have to start from scratch 
• Package (You can create a new basebox based on another according to your needs) 
• Veewee (A tool to automate the creation of a basebox for your particular needs) 
• Don’t reinvent the wheel 
IT Engineering
PPrrooffiitt!! 
● Decrease the time it takes for a developer to get up and 
running on a new project 
● Isolate development environments from each other 
● Increase your chance of successful deployment by mirroring 
the production environment 
● Reuse your Puppet or Chef recipes in production and 
development environments 
● Keep your development machine small and fast
GGooiinngg ffuurrtthheerr 
● Create your own base boxes 
– http://vagrantup.com/docs/base_boxes.html 
● Share your base boxes 
– http://vagrantbox.es 
● Multi-VM configuration 
– http://vagrantup.com/docs/multivm.html 
● Use it on your CI server 
– Ex: http://travis-ci.org 
– https://wiki.jenkins-ci.org/display/JENKINS/Vagrant+Plugin 
● Extend with plugins 
– http://vagrantup.com/docs/plugins.html
QQuueessttiioonnss ?? 
Pizza time!!! 
Thank you Alesi Fuentes

Vagrant and puppet: Deployment made easy

  • 1.
    Vagrant + Puppet: deployment made easy. May 2014
  • 2.
    WWhhoo?? Geronimo Orozco Cloud Engineer & Free Software developer @patux http://patux.net http://github.com/patux
  • 3.
  • 4.
  • 5.
    DDeevveellooppeerr ccoommmmoonn nniigghhttmmaarreess...... Multiple projects + Dependencies on various kinds of software in various degrees of stability = YYoouurr ddeevveellooppmmeenntt mmaacchhiinnee iiss bbeeccoommiinngg ffuullll ooff ccrraapp
  • 6.
    DDeevveellooppeerr ccoommmmoonn nniigghhttmmaarreess...... Multiple projects + Dependencies on the same software but with different versions = YYoouurr ddeevveellooppmmeenntt mmaacchhiinnee iiss bbeeccoommiinngg ffuullll ooff ccrraapp ((aaggaaiinn))
  • 7.
    DDeevveellooppeerr ccoommmmoonn nniigghhttmmaarreess...... Existing developer with (partial and no up to date) info on how to reproduce a development environment + New developer on the team (with a shiny new machine) = IIssssuueess ttoo rreepprroodduuccee tthhee ssaammee ddeevveellooppmmeenntt eennvviirroonnmmeenntt
  • 8.
    DDeevveellooppeerr ccoommmmoonn nniigghhttmmaarreess...... Development environment ≠ Production/CI environment = WWoorrkkss oonn mmyy mmaacchhiinnee!!!!!! ssyynnddrroommee
  • 9.
    AA ddeevveellooppmmeenntt ssttoorryy...... IT Engineering Task Requires Component X Requires Component Y
  • 10.
    AA ddeevveellooppmmeenntt ssttoorryy......wwiitthh ssttoorryy ppooiinnttss 3 88 3 IT Engineering Task Requires Component X Requires Component Y 2
  • 11.
    AA tteeaamm ooff66 mmeemmbbeerrss...... IT Engineering 2 3 3 2 3 3 2 3 3 2 3 3 2 3 3 2 3 3 4488
  • 12.
    $ git clonegit://path/to/myapp.git $ cd myapp $ magic command $ ssh myenvironment . . . hack . . .
  • 13.
    $ git clonegit://path/to/myapp.git $ cd myapp $ vagrant up $ ssh myenvironment . . . hack . . .
  • 14.
    VVaaggrraanntt ● MitchelHashimoto & John Bender ● http://vagrantup.com ● Based on Virtualbox, Ruby ● Runs on MacOS, Linux, Windows ● Supports multiple provisioners (puppet/chef/shell/powershell/Salt/Ansible/Docker) * Vagrant lowers development environment setup time, maximizes dev/prod parity, and makes the "works on my machine" excuse a relic of the past. Developers no longer need to worry about setting up complicated infrastructure components. Projects with conflicting dependencies can each get their own sandbox -- keeping a developer's workstation free of the hacks needed for multiple versions of software to coexist. *http://vagrantup.com
  • 15.
    WWhhyy wwoouulldd uusseeiitt?? ● Reduces setup time (3 steps & you’re ready) ● Simplicity (you don’t have to mess with vbox/vmware api) ● Self-Service (You don’t have to ask for resources) ● Consistency (Your teammate gets the same exact environment) ● Repeatability (You can build/destroy/rebuild/shutdown as you please) ● Contained (You don’t have to pollute your laptop and break things, get the development environment isolated but at the same time connected )
  • 16.
    CCaappaabbiilliittiieess ● Filesharing(A folder from your machine into the virtual machine) ● Port forwarding (A port from the vm pointing to a local port) ● Non-Intrusive (You can use your editor/ide from your machine writing into the shared folder) ● Multi VM Stack – Not only one vm per config file – You can build many environments as you want only limited by your workstation/laptop resources
  • 17.
    VVaaggrraanntt VVaaggrraannttffiillee –Port fortwarding – Synced folders – VM configuration – Network configuration – SSH access – Multiple providers – Multiple provisioners – Non intrusive
  • 18.
  • 19.
    DDeemmoo ttiimmee!! $git clone https://github.com/patux/rails-dev-box $ cd rails-dev-box $ vagrant up $ vagrant ssh
  • 20.
    DDeemmoo ttiimmee!! $cd /vagrant $ git clone https://github.com/railstutorial/sample_app.git $ rvm install ruby-1.8 $ rvm use 1.8 $ cd sample_app $ bundle install $ rake db:setup $ rails server
  • 21.
    PPuuppppeett ● DSLto describe your environment configuration ● http://puppetlabs.com ● http://docs.puppetlabs.com
  • 24.
    DDeevvOOppss && VVaaggrraannttccoommmmuunniittyy • Chef & Puppet Friendly (Puppet standalone/server, Chef solo/server) – We can create/reuse puppet modules or chef recipes ● Integrate to the cloud environment with minor tweaks • Recipes across internet (Just google it: vagrant+project) • http://vagrantbox.es – You don’t have to start from scratch • Package (You can create a new basebox based on another according to your needs) • Veewee (A tool to automate the creation of a basebox for your particular needs) • Don’t reinvent the wheel IT Engineering
  • 25.
    PPrrooffiitt!! ● Decreasethe time it takes for a developer to get up and running on a new project ● Isolate development environments from each other ● Increase your chance of successful deployment by mirroring the production environment ● Reuse your Puppet or Chef recipes in production and development environments ● Keep your development machine small and fast
  • 26.
    GGooiinngg ffuurrtthheerr ●Create your own base boxes – http://vagrantup.com/docs/base_boxes.html ● Share your base boxes – http://vagrantbox.es ● Multi-VM configuration – http://vagrantup.com/docs/multivm.html ● Use it on your CI server – Ex: http://travis-ci.org – https://wiki.jenkins-ci.org/display/JENKINS/Vagrant+Plugin ● Extend with plugins – http://vagrantup.com/docs/plugins.html
  • 27.
    QQuueessttiioonnss ?? Pizzatime!!! Thank you Alesi Fuentes