Multi-provider Vagrant and Chef: AWS, VMware, and more
-
Upload
chef-software-inc -
Category
Technology
-
view
6.513 -
download
1
description
Transcript of Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-Provider VagrantAWS, VMware, and more!
I’m Mitchell HashimotoAlso known as @mitchellh
I make Vagranthttp://vagrantup.com
I build toolshttp://hashicorp.com
http://vagrantup.com
A tool for creating, managing, and distributing portable development environments.
$ vagrant box add base \ http://files.vagrantup.com/precise32.box...
$ vagrant up...
$ vagrant sshvagrant@precise64:~$ echo hellohello
Zero to VM in Seconds
Iterative cookbook development .
Dev, Test, Prod. All the same cookbooks on the same OS.
Create and Manage Virtualized Development Environments
Mitchell Hashimoto
VagrantUp and Running
http://hashi.co/vagrant-book
A brief history of Vagrant...
2010: Vagrant 0.1
Vagrant 0.1 It worked, it was okay, but it was pretty bare.
- VirtualBox: create/destroy- Provision with Chef solo- Only worked on Mac OS X and with Ubuntu VMs.
2012: Vagrant 1.0
Vagrant 1.0.
Solid. Does its job well. Dependable. Stable.
VirtualBox only, but supports Chef, Puppet, and shell scripts. Guest VMs can be any Linux.
2013: Vagrant 1.1+
Vagrant 1.1+: The Future
Works with any provider, not just VirtualBox. Works _really_ well on Windows. Will work well with any guest, not just Linux.
And... lots more TBA.
Multi-ProviderWhat does it mean? Why?
A provider manages compute resources* for Vagrant machines.
* But also sets up networking and some basic storage too.
Vagrant 1.0: VirtualBox was the only “provider”
Vagrant 1.1+: VirtualBox, VMware, AWS, RackSpace, LXC, your toaster.
Why?People actually ask me this once in awhile.
Politely: VirtualBox isn’t great for every situation.
Honestly: VirtualBox sucks*.* Its okay, until you realize almost anything else is way better.
But really, multiple providers enable Vagrant to do new and awesome things.
People love Vagrant for the workflow. Not for VirtualBox.
Other providers let you have that workflow in an environment that works best for you.
New use cases...Vagrant where Vagrant has never gone before.
Continuous IntegrationAWS, LXC, etc. Fantastic.
Develop locally. Test remotely.Work in VirtualBox. Test in AWS (more prod-like).
Deploys“vagrant up” an app for staging/production.
Corporate EnvironmentsMaximize that VMware investment.
Vagrant in VagrantVMware outside. LXC inside. Etcetera.
Keep Dreamin’This is all just the beginning.
Multi-ProviderHow do I use it?
vagrant up --provider=fooWhere foo is “vmware_fusion”, “aws”, etc.
Same Vagrantfile,multiple providers.Pretty magical once you see it.
Vagrant.configure(“2”) do |config| config.vm.box = “precise64”end
A Vagrantfile
$ vagrant box add precise64 \ http://files.vagrantup.com/precise64.box...
$ vagrant box add precise64 \ http://files.vagrantup.com/precise64_vmware_fusion.box...
Some Boxes
$ vagrant up --provider=virtualbox...
OR
$ vagrant up --provider=vmware_fusion...
Up in VirtualBox or VMware
It’s that easy.Seriously. There isn’t a catch.
Best effort.Not every provider can satisfy every Vagrant abstraction, but it won’t fail if it can’t.
Example: AWS networking doesn’t map well to Vagrant networking.
Vagrant + AWS will just ignore networking configurations. Not error. It’ll make a “best effort” to work.
BoxesThey’re now tied to providers.
Template for a machine.Base image for VirtualBox, AMI/metadata for AWS, etc.
$ vagrant box listcentos (virtualbox)precise64 (aws)precise64 (virtualbox)precise64 (vmware_fusion)
Tied to a Provider
You need a box for each provider.This process is manual, for now.
VirtualBox: OVF exportVMware: VMX exportLXC: rootfs tarballAWS: Metadata (AMI info)
What’s in a box?
It varies by provider. Actually, anything can be in a box. The provider is responsible for reading and verifying structure.
Provider-Specific ConfigThe full power of the provider, if you need it.
Abstractions are nice, but sometimes you want to take advantage of specific properties of a provider. For example, AWS can do things VMware can’t, and vice versa.
Provider-specific config lets you do that.
Vagrant.configure(“2”) do |config| config.vm.box = “precise64”
config.vm.provider “virtualbox” do |v| v.customize [“modifyvm”, :id, “--memory”, “2048”] end
config.vm.provider “vmware_fusion” do |v| v.vmx[“memsize”] = “2048” endend
Example: Setting Memory
Vagrant.configure(“2”) do |config| config.vm.box = “precise64”
config.vm.provider “virtualbox” do |v| v.customize [“modifyvm”, :id, “--memory”, “2048”] end
config.vm.provider “vmware_fusion” do |v| v.vmx[“memsize”] = “2048” endend
Example: Setting Memory
Vagrant.configure(“2”) do |config| config.vm.box = “precise64”
config.vm.provider “virtualbox” do |v| v.customize [“modifyvm”, :id, “--memory”, “2048”] end
config.vm.provider “vmware_fusion” do |v| v.vmx[“memsize”] = “2048” endend
Example: Setting Memory
PortableEven if the user doesn’t have that provider installed, the Vagrantfile will still work.
Clear PurposeIt makes it clear that that configuration applies ONLY to specific providers.
PowerA place to expose full capabilities of underlying providers.
Totally OptionalJust use a normal Vagrantfile if you don’t care.This is for power users.
That’s it.Same powerful workflow, clean abstractions, uncompromised flexibility.
Multi-ProviderHow do I get more providers?
VirtualBox only by default.Others must come from plugins. For now.
vagrant plugin install <foo>Providers come from plugins.
vagrant-awsvagrant-lxcvagrant-vmware-fusion ** Requires paid license from HashiCorp.
Eventually first-class.Vagrant will ship with first class support, eventually.
They’re currently plugins to allow bleeding edge providers to mature.
At some point, Vagrant will ship with built-in support for various providers.
Google “x vagrant provider”No single list yet, more providers all the time.
The best way to find providers at the moment is Google. Don’t underestimate how easy this is.
No list because it changes to quickly. Judge the quality based on GitHub pulse.
http://www.vagrantup.com/vmware
Same Vagrant, but powered by VMware technology.
Imagine VirtualBox, then imagine everything better.
Faster, battery-life friendly, more stable.
No kernel panics. Ever. Ever.
$79 per userIt’s how I make my living. <3 Vagrant.
* In addition to VMware licensing cost.
VMware FusionHappy Mac users.
Used by thousands of companies. Stable. Very very happy users.
Not a single refund since launch. Incredible feedback.
VMware WorkstationLinux and Windows.
Launched TODAY. Available TODAY (when talk was given).
Same price, low compared to Workstation. Can run the same VMs as the Fusion provider.
vagrantup.com/vmwareHelp me keep working on this full time.
Launched TODAY. Available TODAY (when talk was given).
Same price, low compared to Workstation. Can run the same VMs as the Fusion provider.
CHEFCONF: 25% off.
vagrantup.com/vmware
* Only good until Tuesday, April 30, 2013
Thank you.http://vagrantup.comhttp://hashicorp.com
by
http://vagrantup.com/vmware