vagrant/docs/systems.md

2.1 KiB

layout title
documentation Documentation - Systems

Systems

Systems are an abstraction within Vagrant which describe how various operating system specific tasks are to be run. Systems abstract away tasks such as shutting down, mounting folders, etc. since some operating systems handle this slightly different. This opens the door to supporting more than unix-like systems.

This topic is for advanced users

The following topic is for advanced users. The majority of Vagrant users will never have to do this. Therefore, only continue if you want to support a non-linux based operating system.

System Tasks

The following is a list of tasks which are delegated to system classes:

  • Halting - Shutting down the machine gracefully
  • Mounting Shared Folders - Creating, mounting, and setting up the permissions for shared folders.

This list will surely grow as Vagrant grows. For now, to implement a custom operating system implementation, only the above two features need to be implemented.

Creating a New System Implementer

Creating a new system implementer is quite simple: Inherit from Vagrant::Systems::Base and implement the stubbed method on that class. Instead of going over each method here, I'll point you to the base source file which is thoroughly commented to explain each method.

Using a New System Implementer

The new system implementer should be specified as the config.vm.system configuration value. By default, this is :linux. A symbol represents a built-in system type. For your custom types, you should set the value as the class name for your new implementer. Below is a sample Vagrantfile which does just this:

{% highlight ruby %}

An example system:

require 'bsd_system'

Vagrant::Config.run do |config|

Set the system to the proper class name:

config.vm.system = BSDSystem end {% endhighlight %}

The configured Vagrant environment will then use the custom system implementation.