Provision Chef with Vagrant-Omnibus Plugin
In this post we show how you can provision Chef from Vagrant using the vagrant-omnibus
plugin. This post is for Ubuntu 14.04 guest running in VirtualBox on Windows 10 host.
Prerequisites
You need VirtualBox and Vagrant installed. To do that, you can follow the steps described in Ubuntu with Vagrant and VirtualBox on Windows.
Install Chef Development Kit (ChefDK)
In PowerShell as Administrator:
Provision Chef
Before you can use Chef Solo, Chef Zero, or Chef Client for provisioning, you need to install the latest Chef client on the guest. This can be done with a shell script or with a Vagrant plugin called vagrant-omnibus
.
In PowerShell:
Open Vagrantfile
and add the following code at the end of the configuration:
# Install the latest version of Chef.
# For more information see https://github.com/chef/vagrant-omnibus
#
config.omnibus.chef_version = :latest
The complete Vagrantfile
file should look like this:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
#
Vagrant.configure(2) do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
#
config.vm.box = "ubuntu/trusty64"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
#
config.vm.provider "virtualbox" do |vb|
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com/v2/virtualbox/configuration.html
# Name used in Oracle VM VirtualBox Manager GUI
vb.name = "Ubuntu-x64-Vagrant"
# Customize the amount of memory on the VM (in MB):
vb.memory = "2048"
# Customize the amount of video memory on the VM (in MB):
vb.customize ["modifyvm", :id, "--vram", "128"]
end
# Install the latest version of Chef.
# For more information see https://github.com/chef/vagrant-omnibus
#
config.omnibus.chef_version = :latest
end
Test
Finally launch and provision the Vagrant box. It should install the latest Chef Client: