vagrant/website/docs/source/v2/plugins/hosts.html.md

1.6 KiB

page_title sidebar_current
Custom Hosts - Plugin Development plugins-hosts

Plugin Development: Hosts

This page documents how to add new host OS implementations to Vagrant, allowing Vagrant to properly configure new host operating systems for features such as NFS shared folders. Prior to reading this, you should be familiar with the plugin development basics.

Warning: Advanced Topic! Developing plugins is an advanced topic that only experienced Vagrant users who are reasonably comfortable with Ruby should approach.

Definition Component

Within the context of a plugin definition, new hosts can be defined like so:

host "some_os" do
  require_relative "host"
  Host
end

Guests are defined with the host method. The first argument is th name of the host. This name isn't actually used anywhere, but may in the future, so choose something helpful. Then, the block argument returns a class that implements the Vagrant.plugin(2, :host) interface.

Implementation

Implementations of hosts subclass Vagrant.plugin(2, :host). Within this implementation, various methods for different tasks must be implemented. Instead of going over each task, the easiest example would be to take a look at an existing host implementation.

There are many host implementations, but you can view the BSD host implementation as a starting point.