A current Chef recipe isn't running because of a bug in version 0.10.10. How can I upgrade the version of Chef that Vagrant uses, to 0.10.12?
I don't want to just update it for the current instance of the VM - I keep destroying and rebuilding those. Do I need to change something in the Vagrant base box, or something in my (physical) system's installation?
Provisioners in Vagrant allow you to automatically install software, alter configurations, and more on the machine as part of the vagrant up process. This is useful since boxes typically are not built perfectly for your use case.
"Vagrant is free and open-source software for creating and configuring virtual development environments. It can be seen as a wrapper around virtualization software such as VirtualBox, KVM, VMware and around configuration management software such as Chef, Salt or Puppet." - wiki.
Using the Vagrant plugin vagrant-omnibus worked great for me:
vagrant plugin install vagrant-omnibus
You can then simply configure your chef version in the Vagrantfile before doing the provisioning:
config.omnibus.chef_version = :latest
You can also specify a specific version:
config.omnibus.chef_version = '11.6.0'
Add the lines
config.vm.provision :shell, :inline => 'apt-get install build-essential ruby1.9.1-dev --no-upgrade --yes' config.vm.provision :shell, :inline => "gem install chef --version 11.4.2 --no-rdoc --no-ri --conservative"
to your Vagrantfile before your config.vm.provision :chef_solo
block.
props to hauraki's comment on http://dougireton.com/blog/2012/12/23/automatically-upgrading-chef-client-on-vagrant-up/
edited to include Jason Mayfield's comment. Make sure and give him an upvote too. I added --no-upgrade
to speed things up and match the --conservative
on the second line. You could instead do what Jason did, and remove both the --no-upgrade
and --conservative
.
edited to include suggested edit by anonymous user228653
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With