Tzu ng
Tzu ng

Reputation: 9244

Chef LWRPs - how to use

I've tried to use chef to make development environment with Vagrant. I'm stuck with the part of installing rubies versions within rbenv when I run vagrant provision. I use gem librarian to download cookbooks and this is my current Vagrantfile : https://github.com/rhacker/vagrant-rails/blob/master/Vagrantfile

This is my repo which stores Cheffile and Vagrantfile : https://github.com/rhacker/vagrant-rails

Upvotes: 2

Views: 922

Answers (1)

axsuul
axsuul

Reputation: 7480

Create site-cookbooks/rbenv/recipes/install.rb with

include_recipe "rbenv::default"
include_recipe "rbenv::ruby_build"

rbenv_ruby "1.9.3-p194"

Now in your Vagrantfile, change to

Vagrant::Config.run do |config|
  config.vm.box = "lucid32"
  config.vm.network :hostonly, "33.33.33.33"
  config.vm.customize do |vm|
    vm.memory_size = 386
  end
  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
    chef.add_recipe "apt"
    chef.add_recipe "build-essential"
    chef.add_recipe "git"
    chef.add_recipe "openssl"
    chef.add_recipe "postgresql"
    chef.add_recipe "rbenv::install"
    chef.add_recipe "unicorn"
  end
end

Upvotes: 6

Related Questions