Skip to content

Instantly share code, notes, and snippets.

@DimaD
Created March 22, 2014 11:21
Show Gist options
  • Save DimaD/9705508 to your computer and use it in GitHub Desktop.
Save DimaD/9705508 to your computer and use it in GitHub Desktop.
Example of vagrant config which picks up a box depending on used provider.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This config uses new syntax for box names which was introduced in vagrant 1.5
Vagrant.require_version ">= 1.5"
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant virtual environment requires a box to build off of.
# Our developers use different virtual machines to work (which can produce
# bugs which are hard to reproduce but let's leave it for now) so we moved
# box definition into configuration of specific provider.
# When user runs `vagrant up` it will pick up correct box
# from provider specific config.
#
# It is implemented with override object which is documented
# here https://docs.vagrantup.com/v2/providers/configuration.html
config.vm.provider :vmware_fusion do |wmf, override|
override.vm.box = "chef/centos-6.5"
wmf.memory = 512
end
config.vm.provider :parallels do |v, override|
override.vm.box = "parallels/centos-6.5"
v.memory = 512
end
config.vm.provider :virtualbox do |vb, override|
override.vm.box = "chef/centos-6.5"
vb.memory = 512
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment