Multi-provider Vagrant Boxes

326 views
Skip to first unread message

Richard Boyd II

unread,
Apr 2, 2014, 12:33:28 AM4/2/14
to vagra...@googlegroups.com
There are several talks & slides talking about multi-provider Vagrant boxes but the documentation doesn't have the kind of depth that I need at this time so I thought I'd bring it to the community. I'll give you some background on what my process is and where we want to go with this:

  1. Use packer to build the base ami and virtualbox OVA machines.
  2. Run that through some shell provisioners.
  3. Chunk both through the Vagrant post-processor and get two Vagrant boxes.
  4. Make something happen.

Step 4 is proving to be elusive. The post processor gives me (when I manually unpackage teh boxes) a Vagrantfile with provider specific settings and the metadata.json file (that is generated).

What I would like to do is combine these two boxes into one uber box to distribute. I can manually add both boxes with the same name and launch vagrant init BOX_NAME then vagrant up --provider=PROVIDER_NAME successfully but I'd love to put both provider configs in the same Vagrantfile. So, here's the questions I have:

A) Can one .box have one Vagrantfile with mutilple providers?

B) If so, how is the metadata.json file structured to handle both provisioners?

C) If so, for Vagrant 1.5, how does the box metadata (for versioning) look in multi-provider?

OR

Do I just make two different boxes, modify their Vagrantfiles to add more config info, and just continue with adding them with the same name but different --provider flags?

Alvaro Miranda Aguilera

unread,
Apr 2, 2014, 4:44:03 AM4/2/14
to vagra...@googlegroups.com
if you host the box in vagrant cloud, you can hace thar, 1 name 2 providers

in the vagrabt cloud you will be creating a pointer, not uploading the actual machine, so nothing stops you to have a box that point to an internal hostname

i think that will help you out of the box immediately..

alvaros-mini:~ alvarom$ vagrant box add hashicorp/precise64

==> box: Loading metadata for box 'hashicorp/precise64'

    box: URL: https://vagrantcloud.com/hashicorp/precise64

This box can work with multiple providers! The providers that it

can work with are listed below. Please review the list and choose

the provider you will be working with.


1) hyperv

2) virtualbox

3) vmware_fusion


Enter your choice: 




--
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 vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Richard Boyd II

unread,
Apr 2, 2014, 8:49:50 AM4/2/14
to vagra...@googlegroups.com
Alvaro,

That's not really a part of this use case. We'll be providing the boxes to our dev team internally and will not be hosting them in the Vagrant Cloud.

Alvaro Miranda Aguilera

unread,
Apr 2, 2014, 1:30:56 PM4/2/14
to vagra...@googlegroups.com
hello

ah well

in that case

you need to import the box first like

vagrant box add <name> <name.box>

so when you do vagrant init name, it will create an initial vagrantfile that have

  config.vm.box = "name"


if you have the box in a internal server, you can distribute the Vagrantfile, and include


  config.vm.box = "name"

  config.vm.box_url = "http://server/path/name.box"



Matt Palmer

unread,
Apr 2, 2014, 6:49:27 PM4/2/14
to vagra...@googlegroups.com
On Wed, Apr 02, 2014 at 05:49:50AM -0700, Richard Boyd II wrote:
> That's not really a part of this use case. We'll be providing the boxes to
> our dev team internally and will not be hosting them in the Vagrant Cloud.

As far as I'm aware, there isn't a publically-available implementation of
the Vagrant Cloud server-side for in-house use. It's a use-case that I'm
interested in, too (hosting multi-provider boxes purely in-house), so at
some point, if there isn't anything else available, I'll be cloning the
Vagrant Cloud server implementation to interoperate with Vagrant 1.5.

- Matt

Reply all
Reply to author
Forward
0 new messages