# Rvm installtion problem

**URL:** <https://forum.ansible.com/t/rvm-installtion-problem/2278>\
**Category:** Get Help\
**Tags:** playbook, ansible-core\
**Created:** [November 9, 2023, 8:00pm UTC](https://forum.ansible.com/t/rvm-installtion-problem/2278 "2023-11-09T20:00:06Z")\
**Posts on this page:** 3\
**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:** [November 9, 2023, 8:00pm UTC](https://forum.ansible.com/t/rvm-installtion-problem/2278/1 "2023-11-09T20:00:06Z")

</div>

after loading the rvm 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

type or paste code here

```

 ![image](https://us1.discourse-cdn.com/ansible/original/2X/7/7a3d7f52de6d6502392de7ac92a22f3ada4026fd.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, 7:04pm UTC](https://forum.ansible.com/t/rvm-installtion-problem/2278/2 "2023-11-13T19:04:21Z")

</div>

Is `rvm` in your PATH ? Also, what’s in `~/.rvm/scripts/rvm` ?

On a more general note, remember each task is running in its own subshell, so what you sourced on a previous task wont be available on the next one. So assuming the file you sourced enable you to run rvm commands, you could try to add your `rvm install` command on the same task you sourced your file (or running your commands from a script at this point).

Also assuming the file you sourced only contains contains envvars, a cleaner way to do it would be to use [environment keyword](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_environment.html) on your task, perhaps using [file lookup plugin](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_lookup.html) to populate envvars.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [December 13, 2023, 7:04pm UTC](https://forum.ansible.com/t/rvm-installtion-problem/2278/3 "2023-12-13T19:04:42Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
