Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using the chef-rvm cookbook by fnichol to perform a system wide installation of Ruby via RVM with the rvm::system recipe. I.e. In my run list, I have (with no additional attributes set):

recipe[rvm::system]

After I cook my ubuntu server, everything works fine as a regular user. i.e.

$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

However, rvmsudo doesn't seem to preserve the RVM environment, or correctly pass it on to sudo. I get the following error:

$ rvmsudo ruby -v
sudo: ruby: command not found

How do I use chef to configure my environment so that rvmsudo has access to the ruby / gem environment?

share|improve this question
add comment

2 Answers

This appears to be a problem with the current version of RVM itself (1.17.0), forcing an older version of RVM solves the issue. I did this by setting the following attributes:

node['rvm']['version'] = "1.16.13"
node['rvm']['branch'] = "none"
share|improve this answer
add comment

You installed ruby only for your user. You should use rvm::system_install for system wide installation.

share|improve this answer
    
Unfortunately this did not resolve the issue. From the documentation: This (recipe[rvm::system]) recipe includes default and system_install. So it would seem that I was already performing a system wide installation of RVM. system_install is used when I want to handle the installation of rubies myself. Not the case in this instance, happy to go with the default 1.9.3. –  Clinton Nov 29 '12 at 0:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.