Question

I recently noticed that I managed to have a version of Vagrant and VirtualBox installed that did not work with my Vagrantfile. Upgrading to the latest Vagrant & VirtualBox fixed the problem.

Is it possible to ensure minimum Vagrant and VirtualBox versions are installed before allowing vagrant up to launch?

Was it helpful?

Solution

For Vagrant itself, there is built-in support:

Vagrant.require_version ">= 1.3.5"

For Virtualbox, you can run some code at the top of your Vagrantfile like this:

if Gem::Version.new(`VBoxManage --version`.strip) < 
Gem::Version.new('5.1.6')
  abort "Please upgrade Virtualbox to 5.1.6 or later!"
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top