Está en la página 1de 70

Multi-Provider Vagrant

AWS, VMware, and more!


Im Mitchell Hashimoto
Also known as @mitchellh
I make Vagrant
http://vagrantup.com
I build tools
http://hashicorp.com
http://vagrantup.com
A tool for creating,
managing, and distributing
portable development
environments.
Zero to VM in Seconds
$ vagrant box add base \
http://files.vagrantup.com/precise32.box
...

$ vagrant up
...

$ vagrant ssh
vagrant@precise64:~$ echo hello
hello
Iterative cookbook
development .
Dev, Test, Prod. All the
same cookbooks on the
same OS.
http://hashi.co/vagrant-book
Create and Manage Virtualized Development Environments

Vagrant
Up and Running

Mitchell Hashimoto
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-Provider
What 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 isnt
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 Integration
AWS, 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 Environments
Maximize that VMware investment.
Vagrant in Vagrant
VMware outside. LXC inside. Etcetera.
Keep Dreamin
This is all just the beginning.
Multi-Provider
How do I use it?
vagrant up --provider=foo
Where foo is vmware_fusion, aws, etc.
Same Vagrantfile,
multiple providers.
Pretty magical once you see it.
A Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = precise64
end
Some Boxes
$ vagrant box add precise64 \
http://files.vagrantup.com/precise64.box
...

$ vagrant box add precise64 \


http://files.vagrantup.com/precise64_vmware_fusion.box
...
Up in VirtualBox or VMware
$ vagrant up --provider=virtualbox
...

OR
$ vagrant up --provider=vmware_fusion
...
Its that easy.
Seriously. There isnt a catch.
Best effort.
Not every provider can satisfy every Vagrant
abstraction, but it wont fail if it cant.

Example: AWS net working doesnt


map well to Vagrant net working.

Vagrant + AWS will just ignore


net working configurations. Not
error. Itll make a best effort to
work.
Boxes
Theyre now tied to providers.
Template for a machine.
Base image for VirtualBox,
AMI/metadata for AWS, etc.
Tied to a Provider
$ vagrant box list
centos (virtualbox)
precise64 (aws)
precise64 (virtualbox)
precise64 (vmware_fusion)
You need a box for
each provider.
This process is manual, for now.
VirtualBox: OVF export
VMware: VMX export
LXC: rootfs tarball
AWS: Metadata (AMI info)
Whats 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 Config
The 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 cant, and
vice versa.

Provider-specific config lets you do that.


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
end
end
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
end
end
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
end
end
Portable
Even if the user doesnt have that provider
installed, the Vagrantfile will still work.
Clear Purpose
It makes it clear that that configuration applies
ONLY to specific providers.
Power
A place to expose full capabilities
of underlying providers.
Totally Optional
Just use a normal Vagrantfile if you dont care.
This is for power users.
Thats it.
Same powerful workflow, clean abstractions,
uncompromised flexibility.
Multi-Provider
How 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-aws
vagrant-lxc
vagrant-vmware-fusion *
* Requires paid license from HashiCorp.
Eventually first-class.
Vagrant will ship with first class support, eventually.

Theyre 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. Dont
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 user
Its how I make my living. <3 Vagrant.

* In addition to VMware licensing cost.


VMware Fusion
Happy Mac users.

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

Not a single refund since


launch. Incredible feedback.
VMware Workstation
Linux 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/vmware
Help 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.com
http://hashicorp.com
http://vagrantup.com/vmware

by

También podría gustarte