Rvm installtion problem

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

- 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

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 on your task, perhaps using file lookup plugin to populate envvars.

1 Like

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