Giter Club home page Giter Club logo

vagrant-hostmanager's Introduction

Vagrant Host Manager

vagrant-hostmanager is a Vagrant 1.1+ plugin that manages the /etc/hosts file on guest machines. Its goal is to enable resolution of multi-machine environments deployed with a cloud provider where IP addresses are not known in advance.

Status

The current implementation is a proof-of-concept supporting the larger objective of using Vagrant as a cloud management interface for development and production environments.

The plugin has been tested with Vagrant 1.1.5.

Installation

Install the plugin following the typical Vagrant 1.1 procedure:

$ vagrant plugin install vagrant-hostmanager

Usage

The plugin hooks into the vagrant up and vagrant destroy commands automatically. When a machine is created or destroyed, all active machines with the same provider will have their /etc/hosts file updated accordingly. Auto update may be disabled by setting the config.hostmanager.auto_update attribute to false in the Vagrantfile.

To update the /etc/hosts file on each active machine manually, run the following command:

$ vagrant hostmanager

A machine's IP address is defined by either the static IP for a private network configuration or by the SSH host configuration. To disable using the private network IP address, set config.hostmanger.ignore_private_ip to true.

A machine's host name is defined by config.vm.hostname. If this is not set, it falls back to the symbol defining the machine in the Vagrantfile.

In addition, the hostmanager.aliases configuration attribute can be used to provide aliases for your host names.

Example configuration:

Vagrant.configure("2") do |config|
  config.hostmanager.auto_update = true
  config.hostmanager.ignore_private_ip = false
  config.vm.define "example-box" do |node|
    node.vm.hostname = "example-box-hostname"
    node.vm.network :private_network, ip: "192.168.42.42"
    node.hostmanager.aliases = %w(example-box.localdomain example-box-alias)
  end
end

Contribute

Contributions are welcome.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.