2

I am trying to install a global version of ruby that other chef recipes will recognize as the system ruby. I am attempting to do this with chef-rbenv which seems to work on a user level but does not work when chef runs ohai. I say it doesn't work when chef runs ohai because cookbooks like passenger_apache2 reference node['languages']['ruby']['ruby_bin'] which points to "/usr/bin/ruby". However when I run ohai logged in as a user I get the rbenv shim location. Am I missing something in my rbenv configuration to see this behavior?

Additional Info:

Platform - amazon (ami-05355a6c)

run_list:

recipe[ruby_build]
recipe[ohai]
recipe[rbenv::system]
recipe[build-essential]
recipe[apache2]
recipe[passenger_apache2]
recipe[passenger_apache2::mod_rails]

--UPDATE

I never got the chef-client ohai to pick up my rbenv settings but this is no longer a problem because I ended up overriding the node attributes in a role. This was only possible due to a recent change (passenger_apache2 commit -a0a32fda0b56228d6e54163c98f6736e17cad12c).

Note: omnibus would likely have solved my problems too.

4

2 回答 2

0

您可以覆盖配方或节点级别的默认属性

我认为这是语法

...
"languages": {
  "ruby": {
    "ruby_bin" : "/usr/bin/ruby42"}
},
...
于 2013-09-16T23:45:06.960 回答
0

这本食谱有一个 Ohai 插件可以做到这一点。你可以:

  • 为此切换食谱;
  • 查看rbenv::ohai_plugin配方并在您的环境中复制它(例如在包装食谱中)。

由于食谱的差异,第一个选项可能无法满足您的需求,而第二个选项可能比看起来更困难(我没有尝试过......)

于 2013-09-17T14:20:10.167 回答