How to Install RVM and RUBY to the specific user in the salt-minion
I am using Ubuntu 12.04 for salt-master and salt-minion.When i try to install a package in the salt-minion using salt, it installs only in the system specific. But i need to install in the user specific. How to Install RVM and RUBY to the specific user in the salt-minion?
You can use user
arg in cmd
state to run it as a specific user, for e.g:
rvm/init.sls:
curl:
pkg:
- installed
rvm:
cmd:
- run
- name: curl -L get.rvm.io | bash -s stable
- user: vagrant
- unless: test -s "$HOME/.rvm/scripts/rvm"
- require:
- pkg: curl
rvm_bashrc:
cmd:
- run
- name: echo "[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm" >> $HOME/.bashrc
- user: vagrant
- unless: grep ".rvm/scripts/rvm" ~/.bashrc
- require:
- cmd: rvm
rvm/ruby/init.sls:
include:
- rvm
ruby:
cmd:
- run
- name: rvm install 2.1.0
- user: vagrant
- unless: test -d $HOME/.rvm/rubies/2.1.0
- require:
- cmd: rvm_bashrc