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?
Asked
Active
Viewed 966 times
1 Answers
3
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
quanta
- 50,327
- 19
- 152
- 213
-
rem@rome:/srv/salt/rvm/ruby$ ls init.sls rem@rome:/srv/salt/rvm$ sudo salt '*' state.sls ruby paris: Data failed to compile: ---------- No matching sls found for 'ruby' in env 'base' – krs Feb 17 '14 at 06:50
-
1It should be `sudo salt '*' state.sls rvm.ruby`. – quanta Feb 17 '14 at 07:04
-
@quanta- please check this link http://pastebin.com/GpK3EkYK – krs Feb 17 '14 at 07:08
-
@krs: _"The following requisites were not found: cmd: rvm_bashrc"_ --> it seems that you forgot to put this part into `rvm/init.sls`? Could you please show us the content of this file? – quanta Feb 17 '14 at 08:00
-
the contents of rvm/init.sls is in http://pastebin.com/8TgkvTeg. Please do check it – krs Feb 17 '14 at 08:40
-
But i am getting problem while i am running sudo salt '*' state.sls rvm.ruby. i am succeeded when i am running sudo salt '*' state.sls rvm i want to do rvm install 2.1.0. please do let me know. – krs Feb 17 '14 at 08:47
-
@quanta- the contents of rvm/ruby/init.sls is pasted in this link http://pastebin.com/TziEQqUB. please do verify this link – krs Feb 17 '14 at 08:55
-
`sudo salt '*' saltutil.sync_all` and try again. – quanta Feb 17 '14 at 09:08
-
while i am running sudo salt '' state.sls rvm.ruby still i am getting the same problem. i had pasted the result here. please do verify this link "http://pastebin.com/xxCUUS0N" and do help me – krs Feb 17 '14 at 09:16
-
let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/13080/discussion-between-krs-and-quanta) – krs Feb 17 '14 at 09:33
-
@krs: your last paste has been removed. – quanta Feb 19 '14 at 18:18
-
@ quanta http://pastebin.com/xxCUUS0N" – krs Feb 21 '14 at 09:25
-
@krs: `cat /path/to/rvm/ruby/init.sls`? – quanta Feb 21 '14 at 15:20
-
@quanta- please do verify this link http://pastebin.com/3WNmfZzW for cat /srv/salt/rvm2/ruby/init.sls – krs Feb 24 '14 at 06:15
-
@krs: Since I see you included the `rvm`, so, how about `cat /srv/salt/rvm/init.sls`? – quanta Feb 24 '14 at 08:02
-
i have only /srv/salt/rvm2/ruby/init.sls – krs Feb 24 '14 at 09:43