2

I tried adding this Play2 cookbook to my list of cookbooks to be run with Vagrant, and upon doing vagrant provision I get the error

FATAL: Gem::InstallError: chef_gem[rubyzip] (play2::default line 20) had an error: Gem::InstallError: rubyzip requires Ruby version >= 1.9.2.

So I used a different basebox that has Ruby 1.9.3 installed:

# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64-ruby1.9.3"

# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "https://dl.dropbox.com/u/14292474/vagrantboxes/precise64-ruby-1.9.3-p194.box"

Provisioning with Vagrant still gives the same error, however. And the box is indeed using Ruby 1.9.3:

$ vagrant ssh
Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-23-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

Welcome to your Vagrant-built virtual machine.
Last login: Sun Aug 19 22:42:58 2012 from 10.0.2.2
vagrant@precise64:~$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

Doing gem install rubyzip works just fine after SSHing into the Vagrant machine. Why does vagrant provision not work here?

wrongusername
  • 18,564
  • 40
  • 130
  • 214

1 Answers1

2

Install it as gem_package, if you want to install it in the system's ruby. Chef brings it's own ruby (concept of the omnibus installer) and chef_gem is the LWRP to install a gem in that environment.

StephenKing
  • 36,187
  • 11
  • 83
  • 112