The Vagrantfile is a Ruby file used to configure Vagrant on a per-project basis. The main function of the Vagrantfile is to describe the virtual machines required for a project as well as how to configure and provision these machines. Although the contents of a Vagrantfile are Ruby, knowledge of Ruby is not necessary to make modifications to the file since it is mostly simple variable assignment.
Vagrantfiles are meant to be committed directly to version control and are expected to behave identically on any system which runs Vagrant. The idea is that when a developer checks out some code from version control which has a Vagrantfile, that developer can simply
vagrant up to get a fully provisioned virtual environment to develop that product.
An important concept to understand is how Vagrant loads the Vagrantfile. Actually, there are a series of Vagrantfiles that Vagrant will load. Each subsequent Vagrantfile loaded will override any settings set previously. The Vagrantfiles that are loaded and the order they’re loaded is shown below:
--vagrantfileoption when packaging.
~/.vagrant.d/) is loaded if it exists. This Vagrantfile allows you to set some defaults that may be specific to your user.
Therefore, the Vagrantfile in the project directory overwrites any conflicting configuration from the home directory which overwrites any conflicting configuration from a box which overwrites any conflicting configuration from the default file.
There are many options available to configure Vagrant. These options include specifying the box to use, shared folders, networking configuration, etc. All the available configuration options are listed below. Click on any for more details of that specific option.