Search code examples
testingvagrantvirtual-machinevirtualizationvagrantfile

Vagrant: How to configure vagrant to use different Vagrantfiles


How to use Vagrant for testing e.g. an application running on a Debian, Ubuntu, SuSE etc. VM.

Current project is having one Vagrantfile having configuration inside. To start the Vagrant VM I'm running

vagrant up
vagrant provision

Now I'm wondering how to do something like

vagrant up suse ... and later vagrant up debian


Solution

  • you can do one of the following:

    1. having git with different branch and the Vagrantfile will be different depending your branch. Be careful though as your .vagrant directory will not match your Vagrantfile, you will need to up and provision each VM and switch the .vagrant directory.

    2. you can use vagrant multi machine generally you use that to reproduce a multi-tier environment so each VM can be up and running at same time, but you can provision and up each VM independently

    3. really use different project folder with each a specific Vagrantfile and a .vagrant directory, each for a specific purpose