rvm / rvm1-ansible

The official ansible RVM role to install and manage your Ruby versions.
MIT License
271 stars 136 forks source link

Permission denied when installing #47

Closed didlix closed 7 years ago

didlix commented 9 years ago

Tried this:

  roles:
    - { role: rvm_io.rvm1-ruby, tags: ruby, rvm1_gpg_key_server: 'hkp://pool.sks-keyservers.net', rvm1_install_flags: '--auto-dotfiles --user-install', rvm1_install_path: '/home/{{ user }}/.rvm' }
TASK: [rvm_io.rvm1-ruby | Select default ruby] ********************************
failed: [default] => {"changed": true, "cmd": ["/home/vagrant/.rvm/bin/rvm", "alias", "create", "default", "ruby-2.1.3"], "delta": "0:00:00.220585", "end": "2015-05-28 14:24:25.562338", "rc": 1, "start": "2015-05-28 14:24:25.341753", "warnings": []}
stderr: touch: cannot touch `/home/vagrant/.rvm/config/alias': Permission denied
mkdir: cannot create directory `/home/vagrant/.rvm/log/1432823065_ruby-2.1.3': Permission denied
tee: /home/vagrant/.rvm/log/1432823065_ruby-2.1.3/alias_create.log: No such file or directory
Error running 'alias_create_execute',
showing last 15 lines of /home/vagrant/.rvm/log/1432823065_ruby-2.1.3/alias_create.log
tail: cannot open `/home/vagrant/.rvm/log/1432823065_ruby-2.1.3/alias_create.log' for reading: No such file or directory
stdout: Creating alias default for ruby-2.1.3.

FATAL: all hosts have already failed -- aborting

And this:

roles:
    - { role: rvm_io.rvm1-ruby, tags: ruby, rvm1_gpg_key_server: 'hkp://pool.sks-keyservers.net', sudo: True }
TASK: [rvm_io.rvm1-ruby | Select default ruby] ********************************
failed: [default] => {"changed": true, "cmd": ["/usr/local/rvm/bin/rvm", "alias", "create", "default", "ruby-2.1.3"], "delta": "0:00:00.233744", "end": "2015-05-28 14:14:04.236077", "rc": 1, "start": "2015-05-28 14:14:04.002333", "warnings": []}
stderr: touch: cannot touch `/usr/local/rvm/config/alias': Permission denied
mkdir: cannot create directory `/usr/local/rvm/log/1432822444_ruby-2.1.3': Permission denied
tee: /usr/local/rvm/log/1432822444_ruby-2.1.3/alias_create.log: No such file or directory
Error running 'alias_create_execute',
showing last 15 lines of /usr/local/rvm/log/1432822444_ruby-2.1.3/alias_create.log
tail: cannot open `/usr/local/rvm/log/1432822444_ruby-2.1.3/alias_create.log' for reading: No such file or directory
stdout: Creating alias default for ruby-2.1.3.

FATAL: all hosts have already failed -- aborting
zachberry commented 8 years ago

I'm running into the same problem, #37 fixes the issue for me.

jawspeak commented 8 years ago

I'm having the same problem, too. No activity on #37 though. Is that the best solution?

nickjj commented 8 years ago

@jawspeak Can you confirm if #37 fixes it for you?

jawspeak commented 8 years ago

It did not. My error was on 'Update rvm' not 'Select default ruby'

TASK: [rvm_io.rvm1-ruby | Update rvm] *****************************************
...
failed: [192.168.33.10] => {"changed": false, "cmd": "/usr/local/rvm/bin/rvm get stable && /usr/local/rvm/bin/rvm reload", "delta": "0:00:00.152132", "end": "2016-01-03 00:38:52.647760", "rc": 1, "start": "2016-01-03 00:38:52.495628", "warnings": []}
stderr: Archives path '/usr/local/rvm/archives' not writable, aborting.

FATAL: all hosts have already failed -- aborting

I had to add this:

- name: Update rvm
  shell: '{{ rvm1_rvm }} get {{ rvm1_rvm_version }} && {{ rvm1_rvm }} reload'
  changed_when: False
  when: rvm_binary.stat.exists and rvm1_rvm_check_for_updates
  # sudo_user: '{{ rvm1_user }}'   <--- doesn't work
  sudo: yes

My playbook had:

- hosts: all
  any_errors_fatal: true
  roles:
    - { role: rvm_io.rvm1-ruby, tags: ruby, sudo: yes }

Although then it has another error. Still working through this. I might go back to manually installing it in my own tasks.

lpaulmp commented 7 years ago

Looks this in an issue of playbook. I close this issue but feel free to re-open