I've found myself a couple of times wanting to create a machine on more 
than one provider at the same time

This is useful when you want to test that the Vagrantfile can be used with 
different providers, or when you build a local VM to make changes, but 
switching to a cloud provider to make your new box public.

But when you try to do this, vagrant says:

> Vagrant currently allows each machine to be brought up with only a single 
> provider at a time. A future version will remove this limitation. Until 
> then, please destroy the existing machine to up with a new provider.
>

At this point, rather than destroy the active machine, I cheat. I just 
rename the machine's folder inside ./.vagrant

mv .vagrant/machines/default .vagrant/machines/default_virtualbox
vagrant up --provider=vmware_fusion
mv .vagrant/machines/default .vagrant/machines/default_vmware_fusion
mv .vagrant/machines/default_virtualbox .vagrant/machines/default

After doing this a few times I decided that i'd better wrap the renaming up 
in a script before I really broke something

I case anyone else finds this useful, the plugin is available at 
https://github.com/glenjamin/vagrant-provider

It provides a `list` command, to find all renamed machine folders
It provides a `stash` command, to rename the current machine folder
And it provides a `pick` command, to rename a stashed folder back into the 
real one.

There is also some sanity checking to try and make sure you don't clobber 
anything important.

NOTE: I expect this approach to be entirely not recommended by the vagrant 
core team, but it does just rename files with a bit of validation checking. 
Hopefully it is a useful stopgap until the real version of this 
functionality makes it upstream.
 

-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to