Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9223987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:12:20+00:00 2026-06-18T04:12:20+00:00

What I have: Chef ; What I need: RVM installed for node[:deploy][:user][:name] . I

  • 0

What I have: Chef;

What I need: RVM installed for node[:deploy][:user][:name]. I need user-wide install, not system-wide.

What I tried latest:

script 'install_rvm' do
  user = node[:deploy][:user][:name]
  interpreter '/bin/bash'
  code "su -l #{user} -c '\curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable'"
  not_if { ::File.exists? "/home/#{user}/.rvm" }
end

When I manually run su -l <username> -c '\curl <long_url> | bash -s stable' on test server surely it works perfectly.
I expect Chef to run the same code, and in logs it seems like it does, but the next execute resource fails because in fact there is no /home/<username>/.rvm present.
Yes I know that in Chef I can specify user as user node[:deploy][:user][:name] instead of changing user with su but for some reason if I do that rvm would try to install itself in /root/.rvm (env not properly reset?).
Well, I would like to ask, why is Chef so extremely crappy even for such dead-simple tasks, but it looks like I’ve chosen the wrong place, so the question is what am I doing wrong or do I miss something obvious?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:12:22+00:00Added an answer on June 18, 2026 at 4:12 am

    Well, at least that worked and may be useful if all better ways to do it with Chef fail for you. Here is the resource for installing ruby

    execute 'install_rvm' do
      user('root')
      user = node[:deploy][:user][:name]
      command "su -l #{user} -c '\curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable'"
      not_if { ::File.exists? "/home/#{user}/.rvm" }
    end
    

    And the bonus one to create gemset if it is not already present:

    execute 'rvm_install_ruby' do
      user('root')
      user = node[:deploy][:user][:name]
      ruby = node[:deploy][:ruby]
      gemset = node[:deploy][:gemset]
      command "su -l #{user} -c 'rvm use #{ruby}@#{gemset} --install --create'"
      not_if do
        if latest_patchlevel = `rvm list`.scan(/(ruby-#{ruby}-p)(\d+)/).map{ |a| a.last.to_i }.sort.last
          `rvm list gemsets`.match /ruby-#{ruby}-p#{latest_patchlevel}@#{gemset}/
        end
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have the following chef role: name test description role for test run_list
Below my code for installing vcider. I am learning chef but have not seen
I have an instance in Engineyard and I want to install postgis. I tried
my two identically wide divs are not displaying next to each other. I have
I have a very simple chef recipe which attempts to install RabbitMQ and several
I have the following json data: { data: [ { name: The Frugalicious Chef,
I have a server managed by Chef. I need to access some values that
I am using chef to automate the install of graphite on ubuntu. I need
I have a chef cookbook which installs nginx and install a custom nginx.conf file.
I have found Can't install chef, gem version conflict with net-ssh net-ssh-multi net-ssh-gateway in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.