puppetlabs/beaker — pull request #238 by domcleal (2014-05-05 19:32:02+00:00)
Title: Support hash of boxes for multiple Vagrant providers

This enables the box to be varied to support different Vagrant backends, so
users have more flexibility about the hypervisor they use.

Host files can now take the following form, with a hash of boxes instead of
the single box/box_url keys:

centos-65-x64:
roles:
- master
platform: el-6-x86_64
boxes:
virtualbox:
box: centos-65-x64-virtualbox-nocm
box_url: http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
libvirt:
box: fm-centos64
box_url: http://m0dlx.com/files/foreman/boxes/centos64.box
hypervisor : vagrant

Users should export VAGRANT_DEFAULT_PROVIDER to change the provider.

---

Generates a Vagrantfile of the form:

Vagrant.configure("2") do |c|
c.vm.define 'centos-65-x64' do |v|
v.vm.hostname = 'centos-65-x64'
v.vm.provider :libvirt do |p, override|
override.vm.box = 'fm-centos64'
override.vm.box_url = 'http://m0dlx.com/files/foreman/boxes/centos64.box'
end
v.vm.provider :virtualbox do |p, override|
override.vm.box = 'centos-65-x64-virtualbox-nocm'
override.vm.box_url = 'http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box'
end
v.vm.base_mac = '080027BEB781'
v.vm.network :private_network, ip: "10.255.86.225", :netmask => "255.255.0.0"
end
c.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
end