Multi-provider Vagrant and Chef: AWS, VMware, and more

70
Multi-Provider Vagrant AWS, VMware, and more!

description

With Vagrant 1.1, you can use the same configuration and workflow to spin up and provision machines in VirtualBox, VMware, AWS, RackSpace, and more. You get all the benefits of Vagrant with the power of working in whatever environment you need to. In this talk, you’ll learn how to use the new multi-provider features of Vagrant to more effectively develop and test Chef cookbooks.

Transcript of Multi-provider Vagrant and Chef: AWS, VMware, and more

Page 1: Multi-provider Vagrant and Chef: AWS, VMware, and more

Multi-Provider VagrantAWS, VMware, and more!

Page 2: Multi-provider Vagrant and Chef: AWS, VMware, and more

I’m Mitchell HashimotoAlso known as @mitchellh

Page 3: Multi-provider Vagrant and Chef: AWS, VMware, and more

I make Vagranthttp://vagrantup.com

Page 4: Multi-provider Vagrant and Chef: AWS, VMware, and more

I build toolshttp://hashicorp.com

Page 5: Multi-provider Vagrant and Chef: AWS, VMware, and more

http://vagrantup.com

Page 6: Multi-provider Vagrant and Chef: AWS, VMware, and more

A tool for creating, managing, and distributing portable development environments.

Page 7: Multi-provider Vagrant and Chef: AWS, VMware, and more

$ vagrant box add base \ http://files.vagrantup.com/precise32.box...

$ vagrant up...

$ vagrant sshvagrant@precise64:~$ echo hellohello

Zero to VM in Seconds

Page 8: Multi-provider Vagrant and Chef: AWS, VMware, and more

Iterative cookbook development .

Page 9: Multi-provider Vagrant and Chef: AWS, VMware, and more

Dev, Test, Prod. All the same cookbooks on the same OS.

Page 10: Multi-provider Vagrant and Chef: AWS, VMware, and more

Create and Manage Virtualized Development Environments

Mitchell Hashimoto

VagrantUp and Running

http://hashi.co/vagrant-book

Page 11: Multi-provider Vagrant and Chef: AWS, VMware, and more

A brief history of Vagrant...

Page 12: Multi-provider Vagrant and Chef: AWS, VMware, and more

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.

Page 13: Multi-provider Vagrant and Chef: AWS, VMware, and more

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.

Page 14: Multi-provider Vagrant and Chef: AWS, VMware, and more

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.

Page 15: Multi-provider Vagrant and Chef: AWS, VMware, and more

Multi-ProviderWhat does it mean? Why?

Page 16: Multi-provider Vagrant and Chef: AWS, VMware, and more

A provider manages compute resources* for Vagrant machines.

* But also sets up networking and some basic storage too.

Page 17: Multi-provider Vagrant and Chef: AWS, VMware, and more

Vagrant 1.0: VirtualBox was the only “provider”

Page 18: Multi-provider Vagrant and Chef: AWS, VMware, and more

Vagrant 1.1+: VirtualBox, VMware, AWS, RackSpace, LXC, your toaster.

Page 19: Multi-provider Vagrant and Chef: AWS, VMware, and more

Why?People actually ask me this once in awhile.

Page 20: Multi-provider Vagrant and Chef: AWS, VMware, and more

Politely: VirtualBox isn’t great for every situation.

Page 21: Multi-provider Vagrant and Chef: AWS, VMware, and more

Honestly: VirtualBox sucks*.* Its okay, until you realize almost anything else is way better.

Page 22: Multi-provider Vagrant and Chef: AWS, VMware, and more

But really, multiple providers enable Vagrant to do new and awesome things.

Page 23: Multi-provider Vagrant and Chef: AWS, VMware, and more

People love Vagrant for the workflow. Not for VirtualBox.

Page 24: Multi-provider Vagrant and Chef: AWS, VMware, and more

Other providers let you have that workflow in an environment that works best for you.

Page 25: Multi-provider Vagrant and Chef: AWS, VMware, and more

New use cases...Vagrant where Vagrant has never gone before.

Page 26: Multi-provider Vagrant and Chef: AWS, VMware, and more

Continuous IntegrationAWS, LXC, etc. Fantastic.

Page 27: Multi-provider Vagrant and Chef: AWS, VMware, and more

Develop locally. Test remotely.Work in VirtualBox. Test in AWS (more prod-like).

Page 28: Multi-provider Vagrant and Chef: AWS, VMware, and more

Deploys“vagrant up” an app for staging/production.

Page 29: Multi-provider Vagrant and Chef: AWS, VMware, and more

Corporate EnvironmentsMaximize that VMware investment.

Page 30: Multi-provider Vagrant and Chef: AWS, VMware, and more

Vagrant in VagrantVMware outside. LXC inside. Etcetera.

Page 31: Multi-provider Vagrant and Chef: AWS, VMware, and more

Keep Dreamin’This is all just the beginning.

Page 32: Multi-provider Vagrant and Chef: AWS, VMware, and more

Multi-ProviderHow do I use it?

Page 33: Multi-provider Vagrant and Chef: AWS, VMware, and more

vagrant up --provider=fooWhere foo is “vmware_fusion”, “aws”, etc.

Page 34: Multi-provider Vagrant and Chef: AWS, VMware, and more

Same Vagrantfile,multiple providers.Pretty magical once you see it.

Page 35: Multi-provider Vagrant and Chef: AWS, VMware, and more

Vagrant.configure(“2”) do |config| config.vm.box = “precise64”end

A Vagrantfile

Page 36: Multi-provider Vagrant and Chef: AWS, VMware, and more

$ vagrant box add precise64 \ http://files.vagrantup.com/precise64.box...

$ vagrant box add precise64 \ http://files.vagrantup.com/precise64_vmware_fusion.box...

Some Boxes

Page 37: Multi-provider Vagrant and Chef: AWS, VMware, and more

$ vagrant up --provider=virtualbox...

OR

$ vagrant up --provider=vmware_fusion...

Up in VirtualBox or VMware

Page 38: Multi-provider Vagrant and Chef: AWS, VMware, and more

It’s that easy.Seriously. There isn’t a catch.

Page 39: Multi-provider Vagrant and Chef: AWS, VMware, and more

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.

Page 40: Multi-provider Vagrant and Chef: AWS, VMware, and more

BoxesThey’re now tied to providers.

Page 41: Multi-provider Vagrant and Chef: AWS, VMware, and more

Template for a machine.Base image for VirtualBox, AMI/metadata for AWS, etc.

Page 42: Multi-provider Vagrant and Chef: AWS, VMware, and more

$ vagrant box listcentos (virtualbox)precise64 (aws)precise64 (virtualbox)precise64 (vmware_fusion)

Tied to a Provider

Page 43: Multi-provider Vagrant and Chef: AWS, VMware, and more

You need a box for each provider.This process is manual, for now.

Page 44: Multi-provider Vagrant and Chef: AWS, VMware, and more

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.

Page 45: Multi-provider Vagrant and Chef: AWS, VMware, and more

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.

Page 46: Multi-provider Vagrant and Chef: AWS, VMware, and more

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

Page 47: Multi-provider Vagrant and Chef: AWS, VMware, and more

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

Page 48: Multi-provider Vagrant and Chef: AWS, VMware, and more

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

Page 49: Multi-provider Vagrant and Chef: AWS, VMware, and more

PortableEven if the user doesn’t have that provider installed, the Vagrantfile will still work.

Page 50: Multi-provider Vagrant and Chef: AWS, VMware, and more

Clear PurposeIt makes it clear that that configuration applies ONLY to specific providers.

Page 51: Multi-provider Vagrant and Chef: AWS, VMware, and more

PowerA place to expose full capabilities of underlying providers.

Page 52: Multi-provider Vagrant and Chef: AWS, VMware, and more

Totally OptionalJust use a normal Vagrantfile if you don’t care.This is for power users.

Page 53: Multi-provider Vagrant and Chef: AWS, VMware, and more

That’s it.Same powerful workflow, clean abstractions, uncompromised flexibility.

Page 54: Multi-provider Vagrant and Chef: AWS, VMware, and more

Multi-ProviderHow do I get more providers?

Page 55: Multi-provider Vagrant and Chef: AWS, VMware, and more

VirtualBox only by default.Others must come from plugins. For now.

Page 56: Multi-provider Vagrant and Chef: AWS, VMware, and more

vagrant plugin install <foo>Providers come from plugins.

Page 57: Multi-provider Vagrant and Chef: AWS, VMware, and more

vagrant-awsvagrant-lxcvagrant-vmware-fusion ** Requires paid license from HashiCorp.

Page 58: Multi-provider Vagrant and Chef: AWS, VMware, and more

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.

Page 59: Multi-provider Vagrant and Chef: AWS, VMware, and more

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.

Page 60: Multi-provider Vagrant and Chef: AWS, VMware, and more

http://www.vagrantup.com/vmware

Page 61: Multi-provider Vagrant and Chef: AWS, VMware, and more

Same Vagrant, but powered by VMware technology.

Page 62: Multi-provider Vagrant and Chef: AWS, VMware, and more

Imagine VirtualBox, then imagine everything better.

Page 63: Multi-provider Vagrant and Chef: AWS, VMware, and more

Faster, battery-life friendly, more stable.

Page 64: Multi-provider Vagrant and Chef: AWS, VMware, and more

No kernel panics. Ever. Ever.

Page 65: Multi-provider Vagrant and Chef: AWS, VMware, and more

$79 per userIt’s how I make my living. <3 Vagrant.

* In addition to VMware licensing cost.

Page 66: Multi-provider Vagrant and Chef: AWS, VMware, and more

VMware FusionHappy Mac users.

Used by thousands of companies. Stable. Very very happy users.

Not a single refund since launch. Incredible feedback.

Page 67: Multi-provider Vagrant and Chef: AWS, VMware, and more

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.

Page 68: Multi-provider Vagrant and Chef: AWS, VMware, and more

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.

Page 69: Multi-provider Vagrant and Chef: AWS, VMware, and more

CHEFCONF: 25% off.

vagrantup.com/vmware

* Only good until Tuesday, April 30, 2013

Page 70: Multi-provider Vagrant and Chef: AWS, VMware, and more

Thank you.http://vagrantup.comhttp://hashicorp.com

by

http://vagrantup.com/vmware