Vagrant for DevOps


With Vagrant we can build and share reproducible and predictable environments using environment-as-code principles.
Vagrant can deploy both on-premise environments based on VirtualBox, VMware, Hyper-V, Parallels and cloud, such as DigitalOcean, Azure and AWS.
I prefer to use tools like CloudFormation to build cloud environments, so I’ll focus on on-premise in this post.

Vagrant can also work with Docker, but now we have native Docker not only on Linux, but also on Windows and OS X, so Vagrant can be used only for complex or legacy Docker scenarios.

Typically Vagrant is used to deploy infrastructure (servers) and Chef, Puppet or Ansible are used to deploy software to those servers.
You can find a full list of providers, provisioners and all other stuff here –


Before we start we need to define a few simple terms:

Box – is a template for vagrant machine;
Vagrant machine – is a virtual machine running in provider;
Provider – is a hypervisor or a cloud, e.g. VirtualBox, VMware, Parallels, Hyper-V or AWS, Azure, etc;
Vagrantfile – is a file that describes environment configuration (one or more VMs, networking, shares, etc.);

Of course we’ll use more vagrant-related terms in this post, but these definitions are absolutely necessary to start.



Installation is an extremely easy process, just visit downloads page and chose your OS.
Default provider for Vagrant is VirtualBox, which isn’t the most powerful solution, but it’s still crossplatform.
VMware Workstation / Fusion are nice, but VMware plugin for Vagrant is still not free to use.
On Windows the best is Hyper-V, but Vagrant can’t create Hyper-V networks yet, and it doesn’t support newest Hyper-V configurations.
Parallels is common for OS X, so I’ll show examples not only with VirtualBox, but with Parallels too.

We can add desired provider(s) to Vagrant installation using vagrant plugin install command:

vagrant plugin install vagrant-parallels
vagrant plugin install vagrant-windows-hyperv

You can define different provider for every VM, but if you want to set it globally, use environment variable VAGRANT_DEFAULT_PROVIDER .
How to set environment variables in OS X 10.11

Here’s general installation result:

Screen Shot 2016-05-23 at 15.30.10

If you need more details about upgrading or backwards compatibility please see docks on vagrantup site.

After successful installation we can move forward to Vagrantfile and Boxes. You can create not only custom Windows boxes, but also Linux-based.  And review example with Ansible!

For more advanced usage checkout my post with Vagrant with AWS and PyCharm / Visual Studio Code description.

I hope this info will be useful for you, and if you need any help feel free to use contact form on the main page.