Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status


vagrant (43) Versions 3.0.2

Installs Vagrant and provides a vagrant_plugin resource for installing Vagrant plugins.

cookbook 'vagrant', '= 3.0.2', :supermarket
cookbook 'vagrant', '= 3.0.2'
knife supermarket install vagrant
knife supermarket download vagrant
Quality 50%

Vagrant Cookbook

Cookbook Version
Build Status

Installs Vagrant 1.6+ and manages Vagrant plugins via a vagrant_plugin resource.

This cookbook is not intended to be used for vagrant "1.0" (gem install) versions. A recipe is provided for removing the gem, see Recipes.

This cookbook is not supported for installing versions of Vagrant older than 1.6.


This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit or come chat with us on the Chef Community Slack in #sous-chefs.


This cookbook should not be used on platforms that Vagrant itself does not support.

Vagrant Supported Platforms

Vagrant does not specifically list supported platforms on the project web site. However, the only platforms with packages provided are:

  • Mac OS X
  • Windows
  • Linux (deb-package based platforms, e.g., Debian and Ubuntu)
  • Linux (rpm-packaged based platforms, e.g., RHEL and CentOS)

Other platforms are not supported. This cookbook attempts to exit gracefully in places where unsupported platforms may cause an issue, but it is strongly recommended that this cookbook not be used on an unsupported platform's node run list or used as a dependency for cookbooks used on unsupported platforms.

Tested with Test Kitchen

  • Ubuntu 18.04
  • CentOS 7.3
  • Windows 2016

Tested manually

  • OS X 10.9

May work on other Debian/RHEL family distributions with or without modification.

This cookbook has test-kitchen support for Windows and Mac OS X, but requires custom Vagrant boxes.

Because Vagrant is installed as a native system package, Chef must run as a privileged user (e.g., root or Administrator).

Use of the AppImage version of Vagrant assumes you have set up support for FUSE filesystems. See FUSE
for general explanation of FUSE. The vagrant installation resource does not install or set up FUSE.


'default' recipe. Install the Vagrant Package

The attributes defined for this cookbook are organized under the
node['vagrant'] namespace.

Attribute Description Type Default
['version'] Vagrant package version String '2.0.3'
['url'] Download Vagrant package from this URL String Calculated by vagrant_package_uri helper method.
['checksum'] Vagrant package checksum (SHA256) String Calculated by vagrant_sha256sum helper method.
['appimage'] Use the appimage version Binary nil
['appimage_file'] Install location String nil

'install_plugins' recipe

Attributes in the table below are under the node['vagrant'] namespace.

Attribute Description Type Default
['plugins'] An array of plugins, e.g. %w(vagrant-aws vagrant-ohai vagrant-omnibus) Array nil
['plugins'] If you want to install specific plugin versions, use the second form of the ['plugins'] array, e.g. [ {name: 'vagrant-ohai', version: '0.1.3'}, {name: 'vagrant-aws', version: '0.6.0'} ] Array of Hashes nil
  • node['vagrant']['plugins'] - A array of plugins. The elements in the array can be a string or a hash. String elements should be the names of plugins to install. Hash elements should have the name key for the plugin name. The options version and env keys may be used to specify the version and any needed environment settings for the plugin. This form is used by the vagrant_plugin resource in the install_plugins recipe.
  • node['vagrant']['user'] - A user that is used to automatically install plugins as for the node['vagrant']['plugins'] attribute.
  • node['vagrant']['password'] - The password for the user. Used for installing as another user on windows systems.


This cookbook includes the:

  • vagrant resource, for installing vagrant.
  • vagrant_plugin resource, for managing vagrant plugins.



  • :install: installs vagrant. Platform specific details are here.


  • :checksum: Vagrant package checksum (SHA256)
  • :url: Download Vagrant package from this URL
  • :version: Vagrant package version
  • :appimage: Install the appimage version of vagrant flag
  • :appimage_file: Install the appimage vagrant file at this location, defaults to /usr/local/bin/vagrant


vagrant 'Vagrant' do
  version node['vagrant']['version']

vagrant 'Vagrant from url' do
  checksum node['vagrant']['checksum']
  url node['vagrant']['url']
  version node['vagrant']['checksum']



  • :install: installs the specified plugin. Default.
  • :uninstall: uninstalls the specified plugin
  • :remove: uninstalls the specified plugin


  • :plugin_name: name attribute, the name of the plugin, e.g. "vagrant-omnibus".
  • :version: version of the plugin to installed, must be specified as a string, e.g., "1.0.2"
  • :env: plugin environment variable settings, some plugins require specific settings
  • :user: a user to run plugin installation as. Usually this is for single user systems (like workstations).
  • :sources: alternate locations to search for plugins. This would commonly be used if you are hosting your vagrant plugins in a custom gem repo


vagrant_plugin 'vagrant-omnibus'

vagrant_plugin 'vagrant-berkshelf' do
  version '1.2.0'
  sources ['', '']
# Install the plugins as the `donuts` user, into ~/donuts/.vagrant.d
# .vagrant.d will be allocated if it does not exist.
# If a specific user, group or mode is desired use a directory resource to
# create the .vagrant.d directory.
vagrant_plugin 'vagrant-aws' do
  user 'donuts'

Install the 'vagrant-winrm' plugin for another user. Windows impersonation

requires a username and password.

vagrant_plugin 'vagrant-winrm' do
  user node['vagrant']['user']
  password node['vagrant']['password']

# Install a plugin in the /root directory
vagrant_plugin 'vagrant-aws' do
  vagrant_home: '/root/.vagrant.d'

ChefSpec Matchers

Matchers are automatically generated by current versions of ChefSpec.


RSpec.describe 'example::default' do
  let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }

  it 'installs the vagrant-omnibus plugin' do
    expect(chef_run).to install_vagrant_plugin('vagrant-omnibus').with(
      user: 'my_user'



The default recipe uses the vagrant resource to install Vagrant. OS specific code is in the install custom resource. If the node['vagrant']['plugins'] attribute is not empty, it includes the install_plugins recipe to install any required vagrant plugins.


Iterates over the node['vagrant']['plugins'] attribute and installs the listed plugins. If that attribute is a hash, it installs the specified plugin version. If the node['vagrant']['user'] attribute is set, the plugins are installed for only that user.


This recipe will attempt to uninstall the vagrant gem with the
gem_package and chef_gem resources. Meaning, it will use the gem
binary in the PATH of the shell executing Chef to uninstall, and
then use Chef's built-in RubyGems to uninstall. If you have a
customized Ruby environment, such as with rbenv or rvm (or other), you
may need to manually remove and clean up anything leftover, such as
running rbenv rehash. Likewise, if you have multiple copies of the
vagrant gem installed, you'll need to clean up all versions. This
recipe won't support such craziness :-).

Notes about specific plugins

  • vagrant-libvirt. Installing this plugin has required setting environment variables on ubuntu system. Adding env CONFIGURE_ARGS: 'with-libvirt-include=/usr/include/libvirt with-libvirt-lib=/usr/lib' to the vagrant_plugin resource properties has worked.


Set the url and checksum attributes on the node. Do this in a role, or
a "wrapper" cookbook. Or, just set the version and let the magic happen.

Then include the default recipe on the node's run list.

To specify plugins for installation in the default recipe, specify an
array for the node['vagrant']['plugins'] attribute. For example, to
install the vagrant-omnibus plugin (any version) and version "1.2.0"
of the vagrant-berkshelf plugin:

node.set['vagrant']['plugins'] = [
  {name: 'vagrant-berkshelf', version: '1.2.0'}

See the attribute tables above.


This project exists thanks to all the people who contribute.


Thank you to all our backers!


Support this project by becoming a sponsor. Your logo will show up here with a link to your website.


All notable changes to this project will be documented in this file.

This project adheres to Semantic Versioning.

3.0.2 - 2022-12-13

Standardise files with files in sous-chefs/repo-management

Standardise files with files in sous-chefs/repo-management

3.0.1 - 2022-02-17

Standardise files with files in sous-chefs/repo-management

3.0.0 - 2021-11-01

  • Enabled unified_mode for all resources.
  • Dropped compatibility with Chef versions < 15.3.
  • Updated Vagrant default version to 2.2.18 (previously was 2.2.4).

2.0.6 - 2021-08-30

  • Standardise files with files in sous-chefs/repo-management

2.0.5 - 2021-06-01

  • Standardise files with files in sous-chefs/repo-management

2.0.4 - 2020-12-31

  • resolved cookstyle error: metadata.rb:31:1 convention: Layout/TrailingEmptyLines

2.0.3 2020-07-14

  • Install plugins in the root user home directory for inspec testing. The plugin location varies depending on environment variables unless explicitly set.
  • Test using ubuntu 20.04
  • Use build_essential to install vagrant-libvirt

2.0.2 2020-06-02

  • resolved cookstyle error: test/fixtures/cookbooks/wintest/resources/authorize_service.rb:11:1 warning: ChefDeprecations/ResourceUsesOnlyResourceName

[2.0.1] 2020-02-01

  • Updated tests to work with root user (as is the case on docker machines)
  • Style Fixes
  • Simplify platform checks
  • Migrated to Github Actions for testing

[2.0.0] 2019-10-11

  • Breaking change. Fail if Vagrant install is attempted on an unsupported OS.
  • Add. Allow the install of the appimage version of Vagrant.
  • Remove. Rubocop.yml doesn'tt need to protect the dangerfile any more.
  • Change. Use the latest cookstyle rules


  • Convert the resources to custom resources
  • Add an env property to the plugin resource to allow for setting environment variables.
  • Add an example of installing the vagrant-libvirt plugin, this plugin requires specific environment variable settings. See vagrant-libvirt/issues/891
  • Add mac test instructions.
  • Update the testing documentation


  • Update the README to describe the new vagrant resource


  • Create a custom resource to install vagrant. Fix issue #69


  • Change the source respository name
  • Add the authorize_service resource for setting up windows testing
  • Use environment variable VAGRANT_HOME as the location to install plugins


  • Add tests for chef-client 14
  • Drop testing for chef-client 12
  • Fix the calculation of the plugin directory location
  • Fixes for Windows 2012R2:
    • The Vagrant installer needs to reboot windows, but the MSI does this in a way that chef can't handle. As an alternative, we make chef interrupt itself and reboot the instance.
    • Related to the above, the MSI returns two specific exit codes when it finishes (but not 0...) that chef needs to know about.
    • Testing windows requires user 'vagrant' to hold the 'Replace a process level token' and 'Adjust Memory Quotas for a process' permissions. At the moment those setting must be made using the secpol.msc interface. A furtur task is to configure the vagrant user via the test cookbook.
    • Vagrant version 1.9.7 suffers from the issue described in #82 (Expected process to exit with [0], but received '-1073741515'). For unknown reasons, this problem is resolved by using 2.0.3 (Perhaps also earlier versions, but they were not tested.)


  • The package extension for the vagrant mac package changed. After version 1.9.2 the extension is _x86_64.dmg.
  • The package extension for the vagrant windows package changed. After version 1.9.5 the extension is machinetype.msi.
  • Added support for amazon linux
  • Make the inspec tests run. Move them to the correct directories.


  • Fixes for Chef 13 compat
  • Install Vagrant 1.9.7 by default


  • Fix #67: Remove depends constraint on Windows 1.x cookbook.


  • Install Vagrant 1.8.5 by default


  • Install Vagrant 1.8.1 by default
  • Switch to InSpec verifier for test-kitchen

0.4.2 - January 7, 2016

  • Fix regression in fetch_platform_checksums_for_version method. Release 0.4.1 changed the checksums URL to the new Hashicorp location and introduced a regression. The fetch_platform_checksums_for_version method now returns the correct URL.

Thanks to Jeff Bachtel for the PR.

0.4.1 - January 6, 2016

  • Hashicorp has moved Vagrant package downloads from to Download Vagrant packages from new location.

0.4.0 - December 21, 2015

  • Bump default Vagrant version to 1.7.4
  • Cookbook no longer fails during compile phase if is unavailable. You can override node['vagrant']['url'] and node['vagrant']['checksum'] if you need to download Vagrant from a different location.
  • Fix idempotency when installing Vagrant Windows package.
  • Refactor Vagrant::Helpers and add test coverage
  • vagrant_plugin resource correctly installs vagrant plugins as another user on Windows.
  • Refactor LWRP and add unit tests.

Dev environment changes

  • Add ChefSpec Custom Matchers for vagrant_plugin.
  • Add Rakefile for testing/style checks.
  • Add Travis-CI integration for style and unit tests
  • Move vagrant_sha256sum mock to spec/support/shared_context.rb
  • Refactor ChefSpec tests - move platform recipe specs into their own spec files


  • #25, #31 Don't evaluate attributes on unsupported platforms


  • #11 Custom plugin sources
  • #14 Implement user-specific plugin installation
  • #20, #21, Fix plugin version detection
  • #28 Improve cross platform support


  • Fix platform_family, redhat is not a family, rhel is. (#18)


  • Add uninstall_gem recipe to remove vagrant (1.0) gem.


  • Initial release of vagrant

Collaborator Number Metric

3.0.2 passed this metric

Contributing File Metric

3.0.2 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must contain a file

Cookstyle Metric

3.0.2 passed this metric

No Binaries Metric

3.0.2 passed this metric

Testing File Metric

3.0.2 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must contain a file

Version Tag Metric

3.0.2 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must include a tag that matches this cookbook version number