厨师LWRPs - 如何使用

nXq*_*Xqd 2 chef-infra

我试图用厨师用Vagrant制作开发环境.我在运行时遇到了在rbenv中安装rubies版本的部分vagrant provision.我gem librarian用来下载cookbook,这是我目前的Vagrantfile:https: //github.com/rhacker/vagrant-rails/blob/master/Vagrantfile

这是我的存储Cheffile和Vagrantfile的仓库:https://github.com/rhacker/vagrant-rails

axs*_*uul 6

创建site-cookbooks/rbenv/recipes/install.rb

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

rbenv_ruby "1.9.3-p194"
Run Code Online (Sandbox Code Playgroud)

现在在你的Vagrantfile,改为

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
Run Code Online (Sandbox Code Playgroud)