

To compile the Vagrantfile into a box: vagrant package To create new Vagrant machines from the Vagrantfile, move to the directory that contains the Vagrant project and run: vagrant up bootstrap.sh is the conventional name used in most cases. We use vm.provision to specify the name of the file that is going to be executed at the machine creation, to provision the machine. The schema for box names is simple: the maintainer account in Vagrant Cloud followed by the box name. It is Ubuntu BionicBeaver (18.04 LTS), 64-bit version, provided by HashiCorp. Vm.box is the base box that we are going to use. We are going to use version 2 of Vagrant API.

In the block, we'll use the config alias to refer this object.

nfigure("2") returns the Vagrant configuration object for the new box. Here is a simple Vagrantfile example: nfigure("2") do |config|Ĭonfig.vm.provision :shell, path: "bootstrap.sh" However, while a box is easy to distribute to a team or to a wider public, a Vagrantfile can also directly create one or more Vagrant machines, without generating any box. From a box, we can create new Vagrant machines. You can see a box as a compiled Vagrantfile.
