You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
need to use a workaround to execute sudo apt-get install 'python-httplib2' when trying to install rvm to a single user using the rvm_io.rvm1-ruby role:
- name: ensure that the appservers can run Ruby
hosts: appservers
remote_user: tcv
pre_tasks:
- name: workaround for install of python-httplib2 in a user-only install
action: apt pkg=python-httplib2 update_cache=yes state=latest
sudo: true
sudo_user: root
- name: put a faster Chinese gem sources
action: copy src="data/gemrc" dest=/home/tcv/.gemrc mode=0600 owner=tcv group=tcv
roles:
- {
role: rvm_io.rvm1-ruby,
tags: ruby,
sudo: true,
sudo_user: 'tcv',
rvm1_group: "{{ ansible_ssh_user }}",
rvm1_temp_download_path: '/tmp',
rvm1_install_path: '~/.rvm',
rvm1_temp_download_path: '/home/{{ ansible_ssh_user }}/src',
rvm1_rubies: ['ruby-2.0.0']
}
tags:
- rvm
Otherwise, Ansible tries to apt-get package without sudo:
failed: [test1.censored.co] => {"failed": true}
stderr: E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
msg: 'apt-get install 'python-httplib2' ' failed: E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
FATAL: all hosts have already failed -- aborting
The text was updated successfully, but these errors were encountered:
Thanks, it's been fixed and it's available on the galaxy as v1.0.2. You shouldn't have to enable sudo: true and sudo_user: tcv in the role if you're installing it to a local user btw.
This fix is still required tho because in that case it needs sudo/root to apt install httplib2.
Just re-tested this on a new host and confirmed the fix works:
before:
ASK: [rvm_io.rvm1-ruby | ensure httplib2 is installed] ***********************
failed: [charaka] => {"failed": true}
stderr: E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
update:
$ ansible-galaxy install --force rvm_io.rvm1-ruby
downloading role 'rvm1-ruby', owned by rvm_io
no version specified, installing v1.0.2
- downloading role from https://github.com/rvm/rvm1-ansible/archive/v1.0.2.tar.gz
- extracting rvm_io.rvm1-ruby to /usr/local/etc/ansible/roles/rvm_io.rvm1-ruby
rvm_io.rvm1-ruby was installed successfully
after:
TASK: [rvm_io.rvm1-ruby | ensure httplib2 is installed] ***********************
changed: [charaka]
need to use a workaround to execute
sudo apt-get install 'python-httplib2'
when trying to install rvm to a single user using the rvm_io.rvm1-ruby role:Otherwise, Ansible tries to apt-get package without sudo:
The text was updated successfully, but these errors were encountered: