Skip to content

Instantly share code, notes, and snippets.

@mlafeldt
Last active December 23, 2015 07:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mlafeldt/6598563 to your computer and use it in GitHub Desktop.
Save mlafeldt/6598563 to your computer and use it in GitHub Desktop.
Install Chef 11 with Vagrant's shell provisioner
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu-12.04"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
# Install Chef version 11
config.vm.provision :shell, :inline => <<EOS
set -e
if ! command -V chef-solo >/dev/null 2>/dev/null; then
curl -L https://www.opscode.com/chef/install.sh | bash -s -- -v 11.6.0
fi
EOS
config.vm.provision :chef_solo do |chef|
# ...
end
end
@gildegoma
Copy link

If you want to setup a "pure" Chef box (without Puppet), you also could use https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box

@mlafeldt
Copy link
Author

@gildegoma Thanks! Will give it a try tomorrow.

@gildegoma
Copy link

Just realized that this box doesn't have curl preinstalled, so the shell bootstrap must be adapted:

sudo apt-get update -qq
sudo apt-get install -qq curl

@mlafeldt
Copy link
Author

@gildegoma Pretty sure it has wget then. :)

@mlafeldt
Copy link
Author

@gildegoma Btw, I'm now using https://github.com/schisamo/vagrant-omnibus which also runs the install.sh script but is much easier to use. It even takes care of the curl/wget issue you ran into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment