MikeV
MikeV

Reputation: 657

Chef ohai doesn't find my rbenv ruby

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.

Upvotes: 2

Views: 698

Answers (2)

cassianoleal
cassianoleal

Reputation: 2566

This cookbook has an Ohai plugin that does that. You could:

  • Switch cookbooks for this one;
  • Have a look in the rbenv::ohai_plugin recipe and reproduce it in your environment (like in a wrapper cookbook).

The first option might not satisfy your needs due to differences in the cookbooks, while the second one might prove more difficult than it seems (I haven't tried...)

Upvotes: 0

mr.buttons
mr.buttons

Reputation: 695

you could overwrite the default attribute at the recipe or node level

i think this is the syntax

...
"languages": {
  "ruby": {
    "ruby_bin" : "/usr/bin/ruby42"}
},
...

Upvotes: 0

Related Questions