Specify Vagrantfile path explicity, if not plugin

addicted2unix picture addicted2unix · Jun 26, 2013 · Viewed 15.3k times · Source

Is there any way to explicity specify the path of a Vagrantfile? My company wants to do something like this: For testing on a confluence machine, type a command like vagrant spinup confluence, and then point that to a Vagrantfile in a different directory that contains the confluence environment, and then brings up all of these machines.

However, it doesn't look like there is any way to explicitly state what Vagrantfile to use, and I'm somewhat (very) new at ruby, so I'm having a hard time writing my own plugin for it. Does anyone have recommendations on what to do? Or has anyone done something similar to this?

Answer

Mark Hobson picture Mark Hobson · Mar 25, 2015

Further to Andrew Lorente's answer, you can also use the VAGRANT_VAGRANTFILE environment variable to specify the filename of the Vagrantfile. This has the advantage over VAGRANT_CWD of not changing the current working directory which can be useful when relying on relative paths.

For example, the following will run vagrant up on Vagrantfile.other:

VAGRANT_VAGRANTFILE=Vagrantfile.other vagrant up

Notes