Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A Vagrant plugin for adding entries to the hosts file of the VM
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib Bump version to 0.0.4.
locales Preliminary i18n support.
.gitignore First commit, proof-of-concept functionality available.
LICENSE First commit, proof-of-concept functionality available. Updated with usage information.

Vagrant VM Hosts Plugin

This Vagrant plugin allows you to add entries to the hosts file of the VM. This is mostly useful in a multi-VM environment, where you might want the virtual machines to reach each other by name through the host-only interface. There are a few other solutions available, but these mostly require OS X, which I do not have.

NOTE: This is the first release, containing only a proof-of-concept implementation. Functionality/configuration is bound to change in the future.


This plugin has been tested on Vagrant 1.0, but will probably also work on somewhat older versions. The easiest way to install it, is through the vagrant gem command:

vagrant gem install vagrant-vmhosts


To let Vagrant add entries to the /etc/hosts file on a VM, use the config.vmhosts.list directive: do |config|
  config.vmhosts.list = hosts

This directive takes an array of hashes, containing the entries you want to add:

hosts = [
          { "ip" => "",
            "canonical" => "",
            "aliases" => ["puppet"] }

The plugin runs at the end of the boot sequence, before the provisioners. So you can use any hostname defined in the array while provisioning. For example, if you have a multi-VM setup with a puppetmaster VM and a VM with a puppet agent pointing to this master, you can use the host entry pointing to the puppetmaster.


  • command
  • unit tests
  • hosts format
  • validate config


Copyright (c) 2012 Cegeka NV


Vagrant-vmhosts is licensed under the Apache License, Version 2.0. See the LICENSE file for more details.

Something went wrong with that request. Please try again.