Share
Embed
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
Transcript
27 slides
-
Virtualize your stack with Vagrant and Puppet Jacob
Mather So;ware Engineer, Mashery -
What is Vagrant? A tool that allows you to
create and configure lightweight, reproducible, and portable development environments. -
How to use Vagrant • Install Vagrant (hKp://vagrantup.com)
• Check out your repository • Run: vagrant up -
Vagrant Terms • Box – Also called base box,
is the base image • Guest – Refers to an individual vm -
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” -
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 -
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 -
Basic VagranVile Vagrant.configure("2") do |config| config.vm.box =
"base-‐box-‐name" config.vm.box_url = ”hKp://some/url.box" end -
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 -
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 -
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', } } -
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 -
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. -
Vagrant Provisioning • Shell Scripts • Ansible
• Chef (Solo and Client) • Puppet (Apply and Agent) -
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. -
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. -
Puppet is built… • To be simple •
With it’s own configuraYon language -
Puppet Terms • Manifests – EssenYally instrucYons •
Modules – Abstracted manifests • Templates – Exactly as it sounds • Facter – Variable manager • Hiera – ConfiguraYon management -
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 -
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 -
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. -
Thank you! More informaYon can be found at:
hKp://jmather.com/talks/2013-‐05-‐25