cookbook 'vagrant', '~> 5.0.0'
vagrant
(46) Versions
5.0.0
-
Follow31
Installs Vagrant and provides resources for managing Vagrant plugins and legacy gem installs.
cookbook 'vagrant', '~> 5.0.0', :supermarket
knife supermarket install vagrant
knife supermarket download vagrant
Vagrant Cookbook
Installs Vagrant and manages Vagrant plugins via custom resources.
This cookbook is not intended to install Vagrant 1.0 RubyGem versions. Use the vagrant_gem resource if you need to remove an old gem install.
This cookbook is not supported for installing versions of Vagrant older than 1.6.
Maintainers
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 sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.
Requirements
This cookbook should not be used on platforms that Vagrant itself does not support.
Vagrant Supported Platforms
Vagrant publishes packages for:
- Mac OS X
- Windows
- Linux (deb-package based platforms, e.g., Debian and Ubuntu)
- Linux (rpm-package based platforms, e.g., RHEL-compatible distributions, Fedora, and Amazon Linux)
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
- AlmaLinux 8+
- Amazon Linux 2023+
- CentOS Stream 9+
- Debian 12+
- Fedora latest
- Oracle Linux 8+
- Rocky Linux 8+
- Ubuntu 22.04+
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.
Migration
This cookbook now exposes custom resources only. Legacy root recipes and attributes were removed.
See [migration.md](migration.md) for examples that map the old recipe and attribute API to resource properties.
Resources
This cookbook includes the:
-
vagrantresource, for installing vagrant. -
vagrant_pluginresource, for managing vagrant plugins. -
vagrant_gemresource, for removing legacy RubyGem installs.
See the resource documentation:
- [vagrant](documentation/vagrant.md)
- [vagrant_plugin](documentation/vagrant_plugin.md)
- [vagrant_gem](documentation/vagrant_gem.md)
vagrant
Actions
-
:install: installs vagrant. Platform specific details are here.
Properties
-
: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 -
:plugins: Install Vagrant plugins after Vagrant is installed -
:plugin_user: User used for plugins installed through thepluginsproperty -
:plugin_password: Password used for plugins installed through thepluginsproperty
Examples
vagrant 'Vagrant' vagrant 'Vagrant from url' do checksum 'abc123' url 'https://releases.hashicorp.com/vagrant/2.4.9/vagrant_2.4.9-1_amd64.deb' version '2.4.9' end vagrant 'Vagrant with plugins' do plugin_user 'root' plugins [ 'vagrant-ohai', { name: 'vagrant-berkshelf', version: '1.2.0' }, ] end
vagrant_plugin
Actions
-
:install: installs the specified plugin. Default. -
:uninstall: uninstalls the specified plugin -
:remove: uninstalls the specified plugin
Properties
-
: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
Examples
vagrant_plugin 'vagrant-omnibus' vagrant_plugin 'vagrant-berkshelf' do version '1.2.0' sources ['http://src1.example.com', 'http://src2.example.com'] end
# 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' end
Install the 'vagrant-winrm' plugin for another user. Windows impersonation
requires a username and password.
vagrant_plugin 'vagrant-winrm' do user 'vagrant' password 'vagrant' end # Install a plugin in the /root directory vagrant_plugin 'vagrant-aws' do vagrant_home '/root/.vagrant.d' end
ChefSpec Matchers
Matchers are automatically generated by current versions of ChefSpec.
Example:
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' ) end end
vagrant_gem
Actions
-
:remove: removes the named gem withgem_packageandchef_gem. Default.
Properties
-
:gem_name: name attribute, the RubyGem to remove.
Examples
vagrant_gem 'vagrant'
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.
Usage
Use the resources directly from a wrapper cookbook. To install Vagrant and plugins:
vagrant 'Vagrant' do plugins [ 'vagrant-omnibus', { name: 'vagrant-berkshelf', version: '1.2.0' }, ] end
Contributors
This project exists thanks to all the people who contribute.
Backers
Thank you to all our backers!
Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
Changelog
All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.
Standardise files with files in sous-chefs/repo-management
Standardise files with files in sous-chefs/repo-management
5.0.0 (2026-05-18)
⚠ BREAKING CHANGES
- migrate vagrant to custom resources (#205)
Features
Bug Fixes
- ci: Update workflows to use release pipeline (#200) (21c2fee)
- Proper location of checksum file after move (33f582f)
4.0.20 (2025-10-16)
Bug Fixes
4.0.19 - 2025-09-04
Standardise files with files in sous-chefs/repo-management
4.0.18 - 2024-11-18
Standardise files with files in sous-chefs/repo-management
Standardise files with files in sous-chefs/repo-management
Standardise files with files in sous-chefs/repo-management
Standardise files with files in sous-chefs/repo-management
Standardise files with files in sous-chefs/repo-management
4.0.9 - 2023-04-07
Standardise files with files in sous-chefs/repo-management
4.0.6 - 2023-04-01
Standardise files with files in sous-chefs/repo-management
4.0.5 - 2023-03-20
Standardise files with files in sous-chefs/repo-management
4.0.4 - 2023-03-15
Standardise files with files in sous-chefs/repo-management
4.0.2 - 2023-02-23
Standardise files with files in sous-chefs/repo-management
4.0.1 - 2023-02-14
Standardise files with files in sous-chefs/repo-management
4.0.0 - 2022-12-23
- Update default version to install to 2.3.4
- Logic fixes for installing >= 2.3.0
- CI and Cookstyle fixes
- Update tested platforms
- Standardize helper library and clean it up
- Cleanup and modernize unit tests
- Fix up generic installation
3.0.2 - 2022-12-13
- 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_modefor 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
1.0.0
- 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
0.9.1
- Update the README to describe the new vagrant resource
0.9.0
- Create a custom resource to install vagrant. Fix issue #69
0.8.1
- 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
0.8.0
- 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.)
0.7.2
- 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.
0.7.1
- Fixes for Chef 13 compat
- Install Vagrant 1.9.7 by default
0.7.0
- Fix #67: Remove depends constraint on Windows 1.x cookbook.
0.6.0
- Install Vagrant 1.8.5 by default
0.5.0
- 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_versionmethod. Release 0.4.1 changed the checksums URL to the new Hashicorp location and introduced a regression. Thefetch_platform_checksums_for_versionmethod 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 bintray.com to hashicorp.com. 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 https://dl.bintray.com is unavailable. You can override
node['vagrant']['url']andnode['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_pluginresource 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
0.3.1
- #25, #31 Don't evaluate attributes on unsupported platforms
0.3.0
- #11 Custom plugin sources
- #14 Implement user-specific plugin installation
- #20, #21, Fix plugin version detection
- #28 Improve cross platform support
0.2.2
- Fix platform_family,
redhatis not a family,rhelis. (#18)
0.2.0
- Add
uninstall_gemrecipe to remove vagrant (1.0) gem.
0.1.1
- Initial release of vagrant
Collaborator Number Metric
5.0.0 passed this metric
Contributing File Metric
5.0.0 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 https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Cookstyle Metric
5.0.0 passed this metric
No Binaries Metric
5.0.0 passed this metric
Testing File Metric
5.0.0 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 https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
5.0.0 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 https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
5.0.0 passed this metric
5.0.0 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 https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Cookstyle Metric
5.0.0 passed this metric
No Binaries Metric
5.0.0 passed this metric
Testing File Metric
5.0.0 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 https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
5.0.0 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 https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
5.0.0 passed this metric
5.0.0 passed this metric
Testing File Metric
5.0.0 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 https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
5.0.0 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 https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
5.0.0 failed this metric
5.0.0 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 https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number