Book Image

Vagrant Virtual Development Environment Cookbook

Book Image

Vagrant Virtual Development Environment Cookbook

Overview of this book

Table of Contents (17 chapters)
Vagrant Virtual Development Environment Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Defining a multimachine environment


The primary reason we wish to create networks of Vagrant machines is often because we wish to model an environment of more than one machine. A common example might be the desire to model a web application with dedicated web server machines and database machines, or even an environment that creates a cluster of identical virtual machines.

In this recipe, we will create a simple multimachine environment as well as look at techniques to create clusters of Vagrant machines.

Getting ready

Before we start with creating an environment of many machines, let's review the technique of defining machine names. When creating a multimachine environment, we'll want to ensure that each machine has a unique name. A unique name can be assigned by defining a new Vagrant machine:

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define "definedmachine" do | definedmachine |
    << Actions >>
  end
end

The config.vm.define method is how we define machines...