Sha256: 5adc3b9a5d587daeccc0e1aef63bca408b43fc01ae388b3971bc5709fa478f89

Contents?: true

Size: 1.59 KB

Versions: 5

Compression:

Stored size: 1.59 KB

Contents

---
page_title: "Custom Hosts - Plugin Development"
sidebar_current: "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](/v2/plugins/development-basics.html).

<div class="alert alert-warn">
	<p>
		<strong>Warning: Advanced Topic!</strong> Developing plugins is an
		advanced topic that only experienced Vagrant users who are reasonably
		comfortable with Ruby should approach.
	</p>
</div>

## Definition Component

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

```ruby
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](https://github.com/mitchellh/vagrant/tree/master/plugins/hosts),
but you can view the [BSD host implementation](https://github.com/mitchellh/vagrant/blob/master/plugins/hosts/bsd/host.rb) as a starting point.

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/website/docs/source/v2/plugins/hosts.html.md
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/website/docs/source/v2/plugins/hosts.html.md
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/website/docs/source/v2/plugins/hosts.html.md
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/website/docs/source/v2/plugins/hosts.html.md
tnargav-1.3.3 website/docs/source/v2/plugins/hosts.html.md