Vagrant Concepts

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

State

Global State

Vagrant maintains state corresponding to all its resources managed for a specific user in ~/.vagrant.d:

The ~/.vagrant.d and its initial sub-directories are automatically created first time vagrant is used in the user's account.

Environment

A Vagrant environment is a directory with a Vagrantfile in it. An environment is identified by an ID. It has a name, a provider, and its associated directory, and at any moment is in a specific state (for example, "running"). The details of all environments for the logged in user is given by the vagrant global-status command.

The environment ID can be used to control the machine from anywhere on the system, by any command that takes a target machine.

Local Project

Environment Operations

Vagrantfile

Vagrantfile

Plugin

https://www.vagrantup.com/docs/plugins/

A plugin extends Vagrant by adding new functionality such as new providers. Plugins extend Vagrant using a stable API. Most of the core Vagrant functionality is implemented using core plugins. Plugins are usually packages as RubyGems.

Plugin State

A plugin is installed by default globally for a user, meaning that its stored in user's global state. As such, plugin identifying information is registered in ~/.vagrant.d/plugins.json and the code itself is stored in ~/.vagrant.d/gems.

Plugin Operations

Box

https://www.vagrantup.com/docs/cli/box.html

Vagrant boxes are prepackaged development environments that are the foundation of Vagrant. In most cases, this is usually just a stripped and naked operating system such as Ubuntu, Debian, or CentOS. Boxes exist with the intention to be provisioned with additional features like Apache and PHP using tools like Chef or Puppet. There are publicly available Vagrant boxes: https://www.vagrantup.com/docs/cli/box.html

Box State

A box is installed by default globally for a user, meaning that its stored in user's global state. As such, box metadata is installed under ~/.vagrant.d/boxes.

Dummy Box

Box Operations

Provider

https://www.vagrantup.com/docs/providers/

A provider is the functionality that allows Vagrant to support a specific type of VM. Vagrant ships out of the box with support for VirtualBox, HyperV and Docker. Support for other types of machines can be added via external providers, integrated with Vagrant via plugins. Examples of such providers are AWS provider.

AWS Provider

AWS Provider