Book Image

Creating Development Environments with Vagrant

By : MICHAEL KEITH PEACOCK
Book Image

Creating Development Environments with Vagrant

By: MICHAEL KEITH PEACOCK

Overview of this book

Table of Contents (17 chapters)
Creating Development Environments with Vagrant Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Provisioning with Chef on Vagrant


Vagrant also supports two methods of using Chef:

  • Chef-solo

  • Chef in client/server mode with Chef client

Let's take a look at how to configure Vagrant with Chef using these two different methods.

Using Chef-solo

Chef-solo is the Chef equivalent of Puppet standalone.

The simplest way to use this within our project is simply to provide a Chef run list to Vagrant; this tells Vagrant which cookbooks should be applied. The following is an example of telling Vagrant to use the PHP cookbook:

config.vm.provision "chef_solo" do |chef| 
  chef.add_recipe "php" 
end

This takes the PHP cookbook from the default cookbooks folder and applies it to the virtual machine.

As with Puppet, Vagrant makes some assumptions by default; they are as follows:

  • Cookbooks are stored in the cookbooks folder within the project root. The chef.cookbooks_path setting allows us to override the cookbooks folder location. We can either provide a single path or an array of paths (wrapped in square brackets...