Question

Installing rvm with Ansible playbook

  • Posted February 15, 2015

I’m learning Ansible and am trying to install rvm with the rvm_io.rvm1-ruby playbook.

It’s failing to create /usr/local/rvm, even though I’m telling it to use sudo.

Has anyone used this playbook successfully, and if so, could you point out what I’m doing wrong please?

Here’s my playbook so far:

---
- name: Install everything
  hosts: "{{ hosts }}"
  remote_user: someone
  sudo: yes

  roles:
    - mysql

    - role: rvm_io.rvm1-ruby
      sudo: True
      rvm1_user: 'someone'
      rvm1_rvm_version: 'stable'
      rvm1_rvm_check_for_updates: True
      rvm1_rubies:
        - '{{ ruby_version }}'

I’ve tried executing both with and without ‘sudo: True’ in the rvm role and the result is the same (I’m assuming sudo should still be active from the initial "sudo: yes’?)

I’m specifying the sudo pwd on the cmd line using -K and the install/configure mysql is working OK, so sudo is definitely being used for that.

If I SSH in as ‘someone’ and

$ sudo mkdir /usr/local/rvm

there’s no problem either.

Thanks!

Subscribe
Share

This comment has been deleted

Hope it should work fine. It is an Ansible role to install and manage ruby versions using rvm.

try:

  • name: Install Bundler command: rvm alias create default ruby-2.1.2-p95 btw. have you seen RVMs support for Ansible

Better to go-through this URL https://github.com/rvm/rvm1-ansible

also can view this url https://github.com/chadoh/ansible-starter


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Thanks Sanjay.

Yes, I’m using the rvm1-ansible playbook, which doesn’t appear to work.

I think I’ll just use a shell command to install rvm instead, like the ansible-starter repo you pointed out.