» Chef Zero Provisioner

Provisioner name: chef_zero

The Vagrant Chef Zero provisioner allows you to provision the guest usingChef, specifically withChef Zero/local mode.

This new provisioner is a middle ground between running a full blownChef Server and using the limited Chef Soloprovisioner. It runs a local in-memory Chef Server and fakes the validationand client key registration.

Warning: If you are not familiar with Chef and Vagrant already,we recommend starting with the shellprovisioner. However, if you are comfortable with Vagrant already, Vagrantis the best way to learn Chef.

» Options

This section lists the complete set of available options for the Chef Zeroprovisioner. More detailed examples of how to use the provisioner areavailable below this section.

  • cookbooks_path (string or array) - A list of paths to where cookbooksare stored. By default this is "cookbooks", expecting a cookbooks folderrelative to the Vagrantfile location.

  • data_bags_path (string or array) - A path where data bags are stored. Bydefault, no data bag path is set. Chef 12 or higher is required to use thearray option. Chef 11 and lower only accept a string value.

  • environments_path (string) - A path where environment definitions arelocated. By default, no environments folder is set.

  • nodes_path (string or array) - A list of paths where node objects(in JSON format) are stored. By default, no nodes path is set. This value isrequired.

  • environment (string) - The environment you want the Chef run to bea part of. This requires Chef 11.6.0 or later, and that environments_pathis set.

  • roles_path (string or array) - A list of paths where roles are defined.By default this is empty. Multiple role directories are only supported byChef 11.8.0 and later.

  • synced_folder_type (string) - The type of synced folders to use whensharing the data required for the provisioner to work properly. By defaultthis will use the default synced folder type. For example, you can set thisto "nfs" to use NFS synced folders.

In addition to all the options listed above, the Chef Zero provisioner supportsthe common options for all Chef provisioners.

» Usage

The Chef Zero provisioner is configured basically the same way as the Chef Soloprovisioner. See the Chef Solo documentationsfor more information.

A basic example could look like this:

  1. Vagrant.configure("2") do |config|
  2. config.vm.provision "chef_zero" do |chef|
  3. # Specify the local paths where Chef data is stored
  4. chef.cookbooks_path = "cookbooks"
  5. chef.data_bags_path = "data_bags"
  6. chef.nodes_path = "nodes"
  7. chef.roles_path = "roles"
  8. # Add a recipe
  9. chef.add_recipe "apache"
  10. # Or maybe a role
  11. chef.add_role "web"
  12. end
  13. end