# Rvm Loading error -Playbook,ruby,rails

**URL:** <https://forum.ansible.com/t/rvm-loading-error-playbook-ruby-rails/622>\
**Category:** Get Help\
**Tags:** ruby, playbook, ubuntu\
**Created:** [September 12, 2023, 8:56pm UTC](https://forum.ansible.com/t/rvm-loading-error-playbook-ruby-rails/622 "2023-09-12T20:56:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shekhar123](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@shekhar123](https://forum.ansible.com/u/shekhar123)\
**Post date:** [September 12, 2023, 8:56pm UTC](https://forum.ansible.com/t/rvm-loading-error-playbook-ruby-rails/622/1 "2023-09-12T20:56:43Z")

</div>

this is the anisble script file :

```auto
- name: Install RVM and Ruby 3.0.0
 shell: |

   curl -sSL https://rvm.io/mpapis.asc | gpg --import -
   curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
   curl -sSL https://get.rvm.io | bash -s stable
   curl -sSL https://get.rvm.io -o rvm.sh
   cat /tmp/rvm.sh | bash -s stable --rails
 become_user: root 

- name: Install RVM and Ruby 3.0.0
 shell: |
   source /home/ubuntu/.rvm/scripts/rvm
   rvm install 3.0.0
   rvm use 3.0.0 --default

```

when i run the ansible command got this error :  
TASK [redisup : Install RVM and Ruby 3.0.0] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [node2]: FAILED! =\> {“changed”: true, “cmd”: “source /home/ubuntu/.rvm/scripts/rvm\nrvm install 3.0.0\nrvm use 3.0.0 --default\n”, “delta”: “0:00:00.003529”, “end”: “2023-09-12 20:45:28.672586”, “msg”: “non-zero return code”, “rc”: 127, “start”: “2023-09-12 20:45:28.669057”, “stderr”: “/bin/sh: 1: source: not found\n/bin/sh: 2: rvm: not found\n/bin/sh: 3: rvm: not found”, “stderr\_lines”: [“/bin/sh: 1: source: not found”, “/bin/sh: 2: rvm: not found”, “/bin/sh: 3: rvm: not found”], “stdout”: “”, “stdout\_lines”: }

 ![image](https://us1.discourse-cdn.com/ansible/original/1X/1fe21940ad7829a81b44e0483ca6b95c768fa94d.png)

---

<div class="post-metadata">

**Author:** ![ptn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ptn/32/481_2.png) [@ptn](https://forum.ansible.com/u/ptn)\
**Post date:** [September 13, 2023, 2:05pm UTC](https://forum.ansible.com/t/rvm-loading-error-playbook-ruby-rails/622/2 "2023-09-13T14:05:11Z")

</div>

Hey,

`source` command is a bash builtin, not sh builtin. Try [using bash](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/shell_module.html#parameter-executable) instead !

---

<div class="post-metadata">

**Author:** ![gwmngilfen](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/gwmngilfen/32/6_2.png) [@gwmngilfen](https://forum.ansible.com/u/gwmngilfen)\
**Post date:** [October 6, 2023, 9:16am UTC](https://forum.ansible.com/t/rvm-loading-error-playbook-ruby-rails/622/3 "2023-10-06T09:16:10Z")

</div>

Hi @shekhar123! It looks like the post might be solved - could you check to see if the response by @ptn worked for you?

If so, it would be _super_ helpful if you could click the ✔ on their post to accept the solution - it helps users find solutions (solved topics have a higher search priority), recognises the input of the people who help you, helps our volunteers find new issues to answer, and keeps the forum nice and tidy. It’s just a nice way to give back, and only takes a moment 🙂

Thanks!  
(this is template reply, do feel free to reply if I’ve misunderstood the situation!)

---

<div class="post-metadata">

**Author:** ![shekhar123](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@shekhar123](https://forum.ansible.com/u/shekhar123)\
**Post date:** [November 9, 2023, 7:56pm UTC](https://forum.ansible.com/t/rvm-loading-error-playbook-ruby-rails/622/5 "2023-11-09T19:56:57Z")

</div>

after loading when i tried to install the rvm it not installing  
i have shared the script file 🙂

```auto
- name: Download and install RVM
  get_url:
    url: "https://get.rvm.io"
    dest: "/tmp/rvm_install.sh"

- name: Run RVM installation script
  script:
    cmd: "/bin/bash /tmp/rvm_install.sh"

- name: Load RVM environment
  ansible.builtin.shell:
    cmd: "~/.rvm/scripts/rvm"
    executable: /bin/bash

- name: Install RVM requirements
  ansible.builtin.shell: 
    cmd: "source ~/.rvm/scripts/rvm && rvm requirements"
    executable: /bin/bash 

#- name: Install RVM
# shell: sudo chmod +x /etc/profile.d/rvm.sh
# become: yes
# shell: "curl -sSL https://get.rvm.io | bash -s stable; source ~/.rvm/scripts/rvm; rvm requirements"
# shell: curl -sSL https://get.rvm.io | bash -s stable

#- name: load rvm
# shell: bash -c "source ~/.rvm/scripts/rvm"

#- name: installing reuqiemnmet of the rvm 
# ansible.builtin.shell:
# cmd: "rvm install 3.1.2"
# executable: bin/bash

- name: installing rvm
  command: rvm install 3.1.2

![image|690x68](upload://hro0y7Fs50sBURT6hsRPGJgApdP.png)

```

---

<div class="post-metadata">

**Author:** ![ptn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ptn/32/481_2.png) [@ptn](https://forum.ansible.com/u/ptn)\
**Post date:** [November 13, 2023, 6:13pm UTC](https://forum.ansible.com/t/rvm-loading-error-playbook-ruby-rails/622/6 "2023-11-13T18:13:47Z")

</div>

Hey,

I’m glad to see you fixed this thread issue ! I also see you opened [a new one](http://forum.ansible.com/t/rvm-installtion-problem/2278) for your now current issue, so I guess you could resolve this one to avoid having a duplicate thread lying around.
