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

7,954 views
7,777 views

Published on

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.

Published in: Technology
0 Comments
22 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
7,954
On SlideShare
0
From Embeds
0
Number of Embeds
1,243
Actions
Shares
0
Downloads
106
Comments
0
Likes
22
Embeds 0
No embeds

No notes for slide

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

  1. 1. Multi-Provider VagrantAWS, VMware, and more!
  2. 2. I’m Mitchell HashimotoAlso known as @mitchellh
  3. 3. I make Vagranthttp://vagrantup.com
  4. 4. I build toolshttp://hashicorp.com
  5. 5. http://vagrantup.com
  6. 6. A tool for creating,managing, and distributingportable developmentenvironments.
  7. 7. $ vagrant box add base http://files.vagrantup.com/precise32.box...$ vagrant up...$ vagrant sshvagrant@precise64:~$ echo hellohelloZero to VM in Seconds
  8. 8. Iterative cookbookdevelopment .
  9. 9. Dev, Test, Prod. All thesame cookbooks on thesame OS.
  10. 10. Create and Manage Virtualized Development EnvironmentsMitchell HashimotoVagrantUp and Runninghttp://hashi.co/vagrant-book
  11. 11. A briefhistory of Vagrant...
  12. 12. 2010: Vagrant 0.1Vagrant 0.1 It worked, itwas okay, but it was prettybare.- VirtualBox: create/destroy- Provision with Chef solo- Only worked on Mac OS Xand with Ubuntu VMs.
  13. 13. 2012: Vagrant 1.0Vagrant 1.0.Solid. Does its job well.Dependable. Stable.VirtualBox only, but supportsChef, Puppet, and shellscripts. Guest VMs can beany Linux.
  14. 14. 2013: Vagrant 1.1+Vagrant 1.1+: The FutureWorks with any provider,not just VirtualBox. Works_really_ well on Windows.Will work well with anyguest, not just Linux.And... lots more TBA.
  15. 15. Multi-ProviderWhat does it mean? Why?
  16. 16. A provider managescompute resources* forVagrant machines.* But also sets up networking and some basic storage too.
  17. 17. Vagrant 1.0: VirtualBoxwas the only “provider”
  18. 18. Vagrant 1.1+: VirtualBox,VMware, AWS, RackSpace,LXC, your toaster.
  19. 19. Why?People actually ask me this once in awhile.
  20. 20. Politely: VirtualBox isn’tgreat for every situation.
  21. 21. Honestly: VirtualBox sucks*.* Its okay, until you realize almost anything else is way better.
  22. 22. But really, multipleproviders enable Vagrantto do new and awesomethings.
  23. 23. People love Vagrant forthe workflow. Not forVirtualBox.
  24. 24. Other providers let youhave that workflow in anenvironment that worksbest for you.
  25. 25. New use cases...Vagrant where Vagrant has never gone before.
  26. 26. Continuous IntegrationAWS, LXC, etc. Fantastic.
  27. 27. Develop locally.Test remotely.Work in VirtualBox. Test in AWS (more prod-like).
  28. 28. Deploys“vagrant up” an app for staging/production.
  29. 29. Corporate EnvironmentsMaximize that VMware investment.
  30. 30. Vagrant in VagrantVMware outside. LXC inside. Etcetera.
  31. 31. Keep Dreamin’This is all just the beginning.
  32. 32. Multi-ProviderHow do I use it?
  33. 33. vagrant up --provider=fooWhere foo is “vmware_fusion”, “aws”, etc.
  34. 34. Same Vagrantfile,multiple providers.Pretty magical once you see it.
  35. 35. Vagrant.configure(“2”) do |config|config.vm.box = “precise64”endA Vagrantfile
  36. 36. $ vagrant box add precise64 http://files.vagrantup.com/precise64.box...$ vagrant box add precise64 http://files.vagrantup.com/precise64_vmware_fusion.box...Some Boxes
  37. 37. $ vagrant up --provider=virtualbox...OR$ vagrant up --provider=vmware_fusion...Up in VirtualBox or VMware
  38. 38. It’s that easy.Seriously. There isn’t a catch.
  39. 39. Best effort.Not every provider can satisfy every Vagrantabstraction, but it won’t fail if it can’t.Example: AWS networking doesn’tmap well to Vagrant networking.Vagrant + AWS will just ignorenetworking configurations. Noterror. It’ll make a “best effort” towork.
  40. 40. BoxesThey’re now tied to providers.
  41. 41. Template for a machine.Base image for VirtualBox,AMI/metadata for AWS, etc.
  42. 42. $ vagrant box listcentos (virtualbox)precise64 (aws)precise64 (virtualbox)precise64 (vmware_fusion)Tied to a Provider
  43. 43. You need a box foreach provider.This process is manual, for now.
  44. 44. 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. Theprovider is responsible forreading and verifyingstructure.
  45. 45. Provider-Specific ConfigThe full power of the provider, if you need it.Abstractions are nice, but sometimesyou want to take advantage of specificproperties of a provider. For example,AWS can do things VMware can’t, andvice versa.Provider-specific config lets you do that.
  46. 46. Vagrant.configure(“2”) do |config|config.vm.box = “precise64”config.vm.provider “virtualbox” do |v|v.customize [“modifyvm”, :id, “--memory”, “2048”]endconfig.vm.provider “vmware_fusion” do |v|v.vmx[“memsize”] = “2048”endendExample: Setting Memory
  47. 47. Vagrant.configure(“2”) do |config|config.vm.box = “precise64”config.vm.provider “virtualbox” do |v|v.customize [“modifyvm”, :id, “--memory”, “2048”]endconfig.vm.provider “vmware_fusion” do |v|v.vmx[“memsize”] = “2048”endendExample: Setting Memory
  48. 48. Vagrant.configure(“2”) do |config|config.vm.box = “precise64”config.vm.provider “virtualbox” do |v|v.customize [“modifyvm”, :id, “--memory”, “2048”]endconfig.vm.provider “vmware_fusion” do |v|v.vmx[“memsize”] = “2048”endendExample: Setting Memory
  49. 49. PortableEven if the user doesn’t have that providerinstalled, the Vagrantfile will still work.
  50. 50. Clear PurposeIt makes it clear that that configuration appliesONLY to specific providers.
  51. 51. PowerA place to expose full capabilitiesof underlying providers.
  52. 52. Totally OptionalJust use a normal Vagrantfile if you don’t care.This is for power users.
  53. 53. That’s it.Same powerful workflow, clean abstractions,uncompromised flexibility.
  54. 54. Multi-ProviderHow do I get more providers?
  55. 55. VirtualBox only by default.Others must come from plugins. For now.
  56. 56. vagrant plugin install <foo>Providers come from plugins.
  57. 57. vagrant-awsvagrant-lxcvagrant-vmware-fusion ** Requires paid license from HashiCorp.
  58. 58. Eventually first-class.Vagrant will ship with first class support, eventually.They’re currently plugins toallow bleeding edge providersto mature.At some point, Vagrant willship with built-in support forvarious providers.
  59. 59. Google “x vagrant provider”No single list yet, more providers all the time.The best way to find providersat the moment is Google. Don’tunderestimate how easy thisis.No list because it changes toquickly. Judge the qualitybased on GitHub pulse.
  60. 60. http://www.vagrantup.com/vmware
  61. 61. Same Vagrant, but poweredby VMware technology.
  62. 62. Imagine VirtualBox, thenimagine everything better.
  63. 63. Faster, battery-life friendly,more stable.
  64. 64. No kernel panics. Ever. Ever.
  65. 65. $79 per userIt’s how I make my living. <3 Vagrant.* In addition to VMware licensing cost.
  66. 66. VMware FusionHappy Mac users.Used by thousands ofcompanies. Stable. Very veryhappy users.Not a single refund sincelaunch. Incredible feedback.
  67. 67. VMware WorkstationLinux and Windows.Launched TODAY. AvailableTODAY (when talk was given).Same price, low compared toWorkstation. Can run the sameVMs as the Fusion provider.
  68. 68. vagrantup.com/vmwareHelp me keep working on this full time.Launched TODAY. AvailableTODAY (when talk was given).Same price, low compared toWorkstation. Can run the sameVMs as the Fusion provider.
  69. 69. CHEFCONF: 25% off.vagrantup.com/vmware* Only good until Tuesday, April 30, 2013
  70. 70. Thank you.http://vagrantup.comhttp://hashicorp.combyhttp://vagrantup.com/vmware

×