You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Chef中无Recipe的ruby_rbenv Cookbook如何加入Runlist并使用?

Fixing Missing Recipe Errors with the ruby_rbenv Cookbook

Hey there! Let's figure out why you're hitting those missing recipe errors and how to get ruby_rbenv working correctly in your Chef setup.

Why You're Seeing These Errors

The ruby_rbenv cookbook has shifted away from traditional recipes to using Chef's custom resources—this is a modern Chef best practice that makes configurations more flexible and reusable. That's why you won't find a recipes/ directory in its source code anymore, and old recipe references like ruby_rbenv::system_install or the default ruby_rbenv recipe don't exist.

How to Use ruby_rbenv Correctly

Instead of adding recipes to your runlist, you'll call the cookbook's custom resources directly from your own cookbook's recipes. Here's a step-by-step breakdown:

  1. Add the Dependency First
    Make sure your cookbook's metadata.rb declares a dependency on ruby_rbenv:

    depends 'ruby_rbenv'
    
  2. Install System-Level rbenv
    To set up rbenv for all system users, use the rbenv_system_install resource in your recipe:

    rbenv_system_install 'system-wide rbenv' do
      user 'root' # Specify the user owning the system rbenv installation
    end
    
  3. Install User-Level rbenv
    For a specific user (like an app deploy user), use the rbenv_user_install resource:

    rbenv_user_install 'deploy-user rbenv' do
      user 'deploy' # Target user for the rbenv installation
    end
    
  4. Install Ruby Versions & Set Global Default
    Once rbenv is installed, use the rbenv_ruby and rbenv_global resources to manage Ruby versions:

    # Install a specific Ruby version for the deploy user
    rbenv_ruby '3.2.2' do
      user 'deploy'
    end
    
    # Set that version as the global default for the user
    rbenv_global '3.2.2' do
      user 'deploy'
    end
    

Key Notes

  • Never add ruby_rbenv or ruby_rbenv::system_install directly to your runlist—these recipe paths no longer exist.
  • Check the README.md file included with the ruby_rbenv cookbook for a full list of custom resources, available parameters, and advanced configurations (like setting custom installation paths or using specific rbenv plugins).

内容的提问来源于stack exchange,提问作者Abhilash

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:19:31