
Chef Infrastructure Automation Cookbook Second Edition
By :

You know how to use Chef to manage the software on individual machines and you know how to use knife to bootstrap individual nodes. Chef Provisioning helps you to use the power of Chef to create your whole infrastructure for you.
No matter whether you want to create a cluster of Vagrant boxes, Docker instances, or Cloud servers, Chef Provisioning lets you define your infrastructure in a simple recipe and run it idempotently.
Let's see how to create a Vagrant machine using a Chef recipe.
Make sure that you have your Berksfile
, my_cookbook
and web_server
roles ready to create an nginx site, as described in Creating nginx virtual hosts section in chapter 6, Users and Applications.
Let's see how to create a Vagrant machine and install nginx on it:
Describe your Vagrant machine in a recipe called mycluster.rb
:
mma@laptop:~/chef-repo $ subl mycluster.rb
require 'chef/provisioning' with_driver 'vagrant' with_machine_options...
Change the font size
Change margin width
Change background colour