GithubHelp home page GithubHelp logo

rvm / rvm1-ansible Goto Github PK

View Code? Open in Web Editor NEW
273.0 29.0 136.0 192 KB

The official ansible RVM role to install and manage your Ruby versions.

License: MIT License

Shell 30.50% Dockerfile 69.50%
ansible rvm ruby ansible-role

rvm1-ansible's Introduction

Build Status OpenCollective OpenCollective Ansible Role Ansible Role Downloads

What is rvm1-ansible?

It is an Ansible role to install and manage ruby versions using rvm.

Why should you use rvm?

In production it's useful because compiling a new version of ruby can easily take upwards of 10 minutes. That's 10 minutes of your CPU being pegged at 100%.

rvm has pre-compiled binaries for a lot of operating systems. That means you can install ruby in about 1 minute, even on a slow micro instance.

This role even adds the ruby binaries to your system path when doing a system wide install. This allows you to access them as if they were installed without using a version manager while still benefiting from what rvm has to offer.

Installation

$ ansible-galaxy install rvm.ruby

Role variables

Below is a list of default values that you can configure:

---

# Install 1 or more versions of ruby
# The last ruby listed will be set as the default ruby
rvm1_rubies:
  - 'ruby-2.3.1'

# Install the bundler gem
rvm1_bundler_install: True

# Delete a specific version of ruby (ie. ruby-2.1.0)
rvm1_delete_ruby:

# Install path for rvm (defaults to single user)
# NOTE: If you are doing a ROOT BASED INSTALL then make sure you
#       set the install path to something like '/usr/local/rvm'
rvm1_install_path: '~/.rvm'

# Add or remove any install flags
# NOTE: If you are doing a ROOT BASED INSTALL then
#       make sure you REMOVE the --user-install flag below
rvm1_install_flags: '--auto-dotfiles  --user-install'

# Add additional ruby install flags
rvm1_ruby_install_flags:

# Set the owner for the rvm directory
# NOTE: If you are doing a ROOT BASED INSTALL then
#       make sure you set rvm1_user to 'root'
rvm1_user: 'ubuntu'

# URL for the latest installer script
rvm1_rvm_latest_installer: 'https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer'

# rvm version to use
rvm1_rvm_version: 'stable'

# Check and update rvm, disabling this will force rvm to never update
rvm1_rvm_check_for_updates: True

# GPG key verification, use an empty string if you want to skip this
# Note: Unless you know what you're doing, just keep it as is
#           Identity proof: https://keybase.io/mpapis
#           PGP message: https://rvm.io/mpapis.asc
rvm1_gpg_keys: '409B6B1796C275462A1703113804BB82D39DC0E3'

# The GPG key server
rvm1_gpg_key_server: 'hkp://keys.openpgp.org'

# autolib mode, see https://rvm.io/rvm/autolibs
rvm1_autolib_mode: 3

# Symlink binaries to system path
rvm1_symlink: true

Example playbooks

---

- name: Configure servers with ruby support for single user
  hosts: all

  roles:
    - { role: rvm.ruby,
        tags: ruby,
        rvm1_rubies: ['ruby-2.3.1'],
        rvm1_user: 'ubuntu'
      }

If you need to pass a list of ruby versions, pass it in an array like so.

---
- name: Configure servers with ruby support system wide
  hosts: all
  roles:
    - { role: rvm.ruby,
        tags: ruby,
        become: yes,

        rvm1_rubies: ['ruby-2.2.5','ruby-2.3.1'],
        rvm1_install_flags: '--auto-dotfiles',     # Remove --user-install from defaults
        rvm1_install_path: /usr/local/rvm,         # Set to system location
        rvm1_user: root                            # Need root account to access system location
      }

rvm_rubies must be specified via ruby-x.x.x so that if you want ruby 2.2.5, you will need to pass in an array rvm_rubies: ['ruby-2.2.5']

System wide installation

The above example would setup ruby system wide. It's very important that you run the play as root because it will need to write to a system location specified by rvm1_install_path

To the same user as ansible_user

In this case, just overwrite rvm_install_path and by default is set the --user-install flag:

rvm1_install_flags: '--auto-dotfiles --user-install'
rvm1_install_path: '/home/{{ ansible_user }}/.rvm'

To a user that is not ansible_user

You will need root access here because you will be writing outside the ansible user's home directory. Other than that it's the same as above, except you will supply a different user account:

rvm1_install_flags: '--auto-dotfiles --user-install'
rvm1_install_path: '/home/someuser/.rvm'

Quick notes about rvm1_user

In some cases you may want the rvm folder and its files to be owned by a specific user instead of root. Simply set rvm1_user: 'foo' and when ruby gets installed it will ensure that foo owns the rvm directory.

This would use Ansible's become under the hood. In case of failures (e.g. Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user), check https://docs.ansible.com/ansible/latest/user_guide/become.html for details and possible solutions.

Upgrading and removing old versions of ruby

A common work flow for upgrading your ruby version would be:

  1. Install the new version
  2. Run your application role so that bundle install re-installs your gems
  3. Delete the previous version of ruby

Leverage ansible's --extra-vars

Just add --extra-vars 'rvm1_delete_ruby=ruby-2.1.0' to the end of your play book command and that version will be removed.

Requirements

Potentially, any Linux/Unix system supported by Ansible and satisfying the RVM prerequisites should work.

Compatibility with Linux distributions based on Debian, Ubuntu or Redhat families is actively tested.

The continuous integration setup of this project currently covers following platforms:

  • CentOS 6, 7 and 8
  • Debian 8, 9 and 10
  • Ubuntu 14.04, 16.04, 18.04 and 20.04

Ansible galaxy

You can find it on the official ansible galaxy if you want to rate it.

Contributing

Backers

Become a backer and support us with a small monthly donation to help us continue our activities.

Backer Backer Backer Backer Backer Backer Backer Backer Backer Backer Backer Backer Backer Backer Backer Backer Backer Backer Backer Backer

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site.

Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor Sponsor

License

MIT

rvm1-ansible's People

Contributors

aguynamedryan avatar danochoa avatar derekgottlieb avatar fuhuxia avatar geerlingguy avatar gildegoma avatar hasanen avatar inferiorhumanorgans avatar jogaco avatar koos303 avatar lpaulmp avatar mikechau avatar mmolinac avatar mokevnin avatar mpapis avatar nathantypanski avatar nickjj avatar philbo avatar pkuczynski avatar pvlltvk avatar rjrobinson avatar sfgeorge avatar stevenhaddox avatar svyatov avatar thbar avatar udondan avatar veger avatar viruzzo avatar wunzeco avatar zeelot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rvm1-ansible's Issues

Installing with --user-install never finishes

Whenever I run the role intending to make a user install, the "Install rubies" task never finishes.
Here's the RVM portion of my yml:

- role: rvm_io.rvm1-ruby
      rvm1_install_flags: '--auto-dotfiles --user-install'
      rvm1_install_path: '/home/{{ ansible_ssh_user }}/.rvm'
      sudo: no

Ansible runs through the previous tasks just fine, but hangs here:

TASK: [rvm_io.rvm1-ruby | Install rubies] ************************************* 

And it never finishes. Hoping someone out there can help me, maybe I'm just specifying the configuration wrong?

The script is running on Ubuntu 14.04. My machine runs OS X Yosemite with Ansible 1.7.1 and the latest version of the role installed via Ansible Galaxy.

errors in rubies task

I'm receiving the following error during the Install rubies task:

error while evaluating conditional: rvm1_rubies and item.rc != 0

When looking at the tasks/rubies.yml file:

In task Install rubies:

 when: rvm1_rubies and item.rc != 0

It seems that the dict attribute rc may be missing at times.

It works fine when there's a fallback value.

 when: rvm1_rubies and item.rc|default(0) != 0

In task Select default ruby:

The stdout may need a default fallback as well. It threw errors as well.

when: detect_default_ruby_version.stdout == '' or
        rvm1_default_ruby_version not in detect_default_ruby_version.stdout

works fine when changed to:

when: detect_default_ruby_version.stdout|default() == '' or
        rvm1_default_ruby_version not in detect_default_ruby_version.stdout

Fixing these two lines solved my problem.

Here are some rvm1 variables I'm using in case it helps:

rvm1_rubies:
  - 'ruby-2.2.0'
rvm1_install_flags: '--auto-dotfiles --user-install'
rvm1_rvm_version: 'stable'
rvm1_rvm_check_for_updates: True

Failed to validate the SSL certificate

I was trying to do a fresh install on a totally new EC2 instance (Ubuntu 14) And I am getting a 'Failed to validate the SSL certificate' error on "TASK: [rvm_io.rvm1-ruby | Install rvm installer]". This is the ansible output:
TASK: [rvm_io.rvm1-ruby | Detect rvm installer] *******************************
ok: [52.5.52.143]

TASK: [rvm_io.rvm1-ruby | Detect current rvm version] *************************
skipping: [52.5.52.143]

TASK: [rvm_io.rvm1-ruby | Install rvm installer] ******************************
failed: [52.5.52.143] => {"failed": true, "item": ""}
msg: Failed to validate the SSL certificate for raw.githubusercontent.com:443. Use validate_certs=no or make sure your managed systems have a valid CA certificate installed. Paths checked for this platform: /etc/ssl/certs, /etc/pki/ca-trust/extracted/pem, /etc/pki/tls/certs, /usr/share/ca-certificates/cacert.org, /etc/ansible

FATAL: all hosts have already failed -- aborting

Thanks

symlink fail

Any ideas?

TASK: [rvm_io.rvm1-ruby | Symlink ruby related binaries on the system path] ***
failed: [dl1.example.com] => (item=bundle) => {"failed": true, "gid": 0, "group": "root", "item": "bundle", "mode": "0777", "owner": "root", "path": "/usr/local/bin/bundle", "size": 42, "src": "/usr/local/rvm/wrappers/default/bundle", "state": "link", "uid": 0}
msg: src file does not exist, use "force=yes" if you really want to create the link: /usr/local/rvm/wrappers/default/bundle

Fails on CentOS 7

Hi developer,

I'm getting errors when running this against centos 7.

"No Package matching 'python-httplib2' found available, installed or updated"

The best way may be having pip install it, but pip isn't available as a package and it's installation would require several steps.

Thanks,
Jonathan

Error (wrong wrapper dir) while trying to install bundler after Ruby 2.2.2

Hi,

I've encountered an error when the script tries to install bundler after installing Ruby 2.2.2 - its trying to run gem commands from a missing directory: /home/vagrant/.rvm/wrappers/2.2.2/

The correct directory appears to be /home/vagrant/.rvm/wrappers/ruby-2.2.2/

Platform: fresh install of Ubuntu 14.04 on a VirtualBox VM using Vagrant on an OS X host.

The role config is:

- role: rvm_io.rvm1-ruby
          rvm1_install_flags: '--auto-dotfiles --user-install'
          rvm1_install_path: '/home/{{ ansible_ssh_user }}/.rvm'
          rvm1_rvm_version: 'stable'
          rvm1_rvm_check_for_updates: True
          rvm1_user: vagrant
          rvm1_rubies:
              - '2.2.2'
          sudo: True

Here's the full error output (vvv):

==> default: TASK: [rvm_io.rvm1-ruby | Install bundler if not installed] ******************* 
==> default: <127.0.0.1> REMOTE_MODULE command creates=/home/vagrant/.rvm/wrappers/2.2.2/bundler /home/vagrant/.rvm/wrappers/2.2.2/gem list | if ! grep "^bundler " ; then /home/vagrant/.rvm/wrappers/2.2.2/gem install bundler ; fi #USE_SHELL
==> default: <127.0.0.1> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1434192757.44-60640508941126 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1434192757.44-60640508941126 && echo $HOME/.ansible/tmp/ansible-tmp-1434192757.44-60640508941126']
==> default: <127.0.0.1> PUT /tmp/tmp3hKVvO TO /root/.ansible/tmp/ansible-tmp-1434192757.44-60640508941126/command
==> default: <127.0.0.1> EXEC /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=ccoaibhpfmqqlhuzmhxhvgnmmyvvzrqh] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-ccoaibhpfmqqlhuzmhxhvgnmmyvvzrqh; LANG=C LC_CTYPE=C /usr/bin/python /root/.ansible/tmp/ansible-tmp-1434192757.44-60640508941126/command; rm -rf /root/.ansible/tmp/ansible-tmp-1434192757.44-60640508941126/ >/dev/null 2>&1'"'"''
==> default: failed: [127.0.0.1] => (item=2.2.2) => {"changed": false, "cmd": "/home/vagrant/.rvm/wrappers/2.2.2/gem list | if ! grep \"^bundler \" ; then /home/vagrant/.rvm/wrappers/2.2.2/gem install bundler ; fi", "delta": "0:00:00.007698", "end": "2015-06-13 10:52:37.563563", "item": "2.2.2", "rc": 127, "start": "2015-06-13 10:52:37.555865", "stdout_lines": [], "warnings": []}
==> default: stderr: /bin/sh: 1: /home/vagrant/.rvm/wrappers/2.2.2/gem: not found
==> default: /bin/sh: 1: /home/vagrant/.rvm/wrappers/2.2.2/gem: not found

Also including a prior error in case it's relevant (though Ruby 2.2.2 appears to have be successfully installed):

TASK: [rvm_io.rvm1-ruby | Install rubies] ************************************* 
changed: [127.0.0.1] => (item={'cmd': ['~/.rvm/bin/rvm', '2.2.2', 'do', 'true'], 'end': '2015-06-13 07:57:36.806564', 'stderr': 'ruby-2.1.2 is not installed.\nRuby ruby-2.2.2 is not installed.', 'stdout': "To install do: 'rvm install ruby-2.1.2'", 'item': '2.2.2', 'changed': False, 'rc': 2, 'failed': False, 'warnings': [], 'delta': '0:00:00.539307', 'invocation': {'module_name': u'command', 'module_args': u'~/.rvm/bin/rvm 2.2.2 do true'}, 'stdout_lines': ["To install do: 'rvm install ruby-2.1.2'"], 'failed_when_result': False, 'start': '2015-06-13 07:57:36.267257'})

migrate repository to rvm organizartion

I was thinking as you do quite good job here and use rvm we could migrate this repository to rvm organization, if you agree migrate to the rvm org and I will add you to rvm team so you can still have full access

Commit 34445bee breaks the role.

TASK: [rvm_io.rvm1-ruby | Symlink ruby related binaries on the system path] *** 
failed: [example.com] => (item=bundle) => {"failed": true, "item": "bundle", "path": "/usr/local/bin/bundle", "src": "/usr/local/rvm/wrappers/default/bundle", "state": "absent"}
msg: src file does not exist, use "force=yes" if you really want to create the link: /usr/local/rvm/wrappers/default/bundle
failed: [example.com] => (item=bundler) => {"failed": true, "item": "bundler", "path": "/usr/local/bin/bundler", "src": "/usr/local/rvm/wrappers/default/bundler", "state": "absent"}
msg: src file does not exist, use "force=yes" if you really want to create the link: /usr/local/rvm/wrappers/default/bundler
changed: [example.com] => (item=erb)
changed: [example.com] => (item=executable-hooks-uninstaller)
changed: [example.com] => (item=gem)
changed: [example.com] => (item=irb)
changed: [example.com] => (item=rake)
changed: [example.com] => (item=rdoc)
changed: [example.com] => (item=ri)
changed: [example.com] => (item=ruby)
changed: [example.com] => (item=testrb)

FATAL: all hosts have already failed -- aborting

Only defined var is rvm1_rubies: ["ruby-2.2.3"], target machine is
running Ubuntu 14.04.3 (Vagrant ubuntu/trusty64), the host is using
Ansible 1.9.2.

user install hangs on user input

hello,
I try to use the ansible role rvm_io.rvm1-ruby to install rvm for a certain user.

  • role: rvm_io.rvm1-ruby
    when: true
    sudo: yes
    rvm1_user: 'archief'
    rvm1_rvm_version: 'stable'
    rvm1_rvm_check_for_updates: false
    rvm1_gpg_keys: ''
    rvm1_rubies:
    - 'ruby-1.9.3'
    rvm1_install_flags: '--auto-dotfiles --user-install'
    rvm1_install_path: '/home/archief/.rvm'
    environment:
    http_proxy: http://172.22.7.136:8080
    https_proxy: https://172.22.7.136:80

When doing 'install rubies' it hangs. When I run it manually, it appears it is waiting for the sudo password:

archief@ubtest:$ rvm install 1.9.3
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/14.04/x86_64/ruby-1.9.3-p551.tar.bz2
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating systemarchief password required for 'apt-get --quiet --yes update': ..-
archief@ubtest:
$

I'd rather not make this user a sudoer without password, so I hope there is an alternative.
This could be:

  • not running with' sudo: yes' and doing the system requirements check beforehand, using the remote user that has provided a sudo password (what commands should I run then, is the apt-get in the rvm output sufficient?)
  • a way to provide the sudo password of the rvm_user

Another thing that troubled me is that the command initially really did nothing because of the fact the https-proxy had to be set. In the above example, the environment setting did nothing: the variable was not visible in the user shell. I worked around it by writing a .curlrc with the proxy setting first, but that only works with curl; I don't know if other processes need that proxy setting too. If so, is there a way to supply the ansible role with that system variable, similar to my try in the example above?

regards, ruud

Fall back to local file when get.rvm.io is down

This is probably just the worst timing ever, but get.rvm.io is down right now. I can't help but wonder how many ruby deployments aren't able to succeed now (not just from this, but globally).

It would be nice to have a fall back, so that when it is down, the last known rvm-installation file can be copied over and used.

Thoughts?

Bundler doesn't get included?

The rvm1 role attempts to create the symlinks for bundle and bundler into /usr/local/bin, but it looks like they (and the gem) haven't been installed yet:

TASK: [rvm1 | Symlink ruby related binaries on the system path] *************** 
failed: [prme-elab2-dhcp65] => (item=bundle) => {"failed": true, "item": "bundle", "path": "/usr/local/bin/bundle", "src": "/opt/rvm/wrappers/default/bundle", "state": "absent"}
msg: src file does not exist, use "force=yes" if you really want to create the link: /opt/rvm/wrappers/default/bundle
failed: [prme-elab2-dhcp65] => (item=bundler) => {"failed": true, "item": "bundler", "path": "/usr/local/bin/bundler", "src": "/opt/rvm/wrappers/default/bundler", "state": "absent"}
msg: src file does not exist, use "force=yes" if you really want to create the link: /opt/rvm/wrappers/default/bundler
ok: [prme-elab2-dhcp65] => (item=erb) => {"changed": false, "dest": "/usr/local/bin/erb", "gid": 0, "group": "root", "item": "erb", "mode": "0777", "owner": "root", "size": 29, "src": "/opt/rvm/wrappers/default/erb", "state": "link", "uid": 0}

My rubies list just contains ruby-1.9.3-p547 and rvm version is 1.26.11. I'm using ansible 1.8.4 against a CentOS 7 box.

I'm confused -- I'm not sure how bundler is supposed to have been installed -- but it is explicitly listed in the list of scripts to symlink in the role's var file.

Painful upgrade from version 1.3.1 to 1.3.7 because of rvm1_install_path change

I was trying to upgrade from version 1.3.1 to 1.3.7
I got following error:

 (item=ruby-2.2.2) => {"changed": false, "cmd": "/usr/local/rvm/wrappers/ruby-2.2.2/gem list | if ! grep \"^bundler \" ; then /usr/local/rvm/wrappers/ruby-2.2.2/gem install bundler ; fi", "delta": "0:00:00.014864", "end": "2015-04-29 10:14:01.134892", "item": "ruby-2.2.2", "rc": 127, "start": "2015-04-29 10:14:01.120028", "stdout_lines": [], "warnings": []}
stderr: /bin/sh: /usr/local/rvm/wrappers/ruby-2.2.2/gem: No such file or directory
/bin/sh: /usr/local/rvm/wrappers/ruby-2.2.2/gem: No such file or directory

I have RVM installed in /usr/local/lib/rvm because this was the default directory in version in 1.3.1. It was later changed to /usr/local/rvm, but RVM somehow didn't get "reinstalled" to this new directory after updating to 1.3.7. /usr/local/rvm/wrappers is empty. That's why installing bundler fails.

When I changed rvm1_install_path back to /usr/local/lib/rvm installation proceeded without further errors.

Support for proxy

I use a Squid proxy to accelerate repeated virtual machines install provisioned using Ansible.

There doesn't seem to be a way to set environment variables globally per playbook or role so bundler, gem and rvm all need to be set separately

This is how it works for rvm: http://rvm.io/workflow/proxy

For now, I'll set up a ~/.curlrc, but it would be nice if the rvm1.io role would take a var for this.

I have at least one other place I use proxy with the bundler by setting the environment variable so it would probably be similar to this:

    - name: with parallel install (see https://github.com/bundler/bundler/pull/2481)
      command: "{{rvm1_bundle}} install -j4"
      environment:
        http_proxy: "{{host_proxy}}"
        HTTP_PROXY: "{{host_proxy}}"
      tags: parallel_install

Installing in another users ~

I am installing jenkins via ansible and I am trying to install rvm for it. I want to install rvm in /var/lib/jenkins/.rvm or rather ~/.rvm for the jenkins user.

I tried

    rvm1_user: jenkins

But that installed in /usr/local/rvm

I then added
rvm1_install_path: '~/.rvm'
and sudo:false
but this ended up installing to my SSH user's (ubuntu) ~/.rvm

Is there a way to do this without hard coding the exact path? or should I just use the default install?

Symlink to bundler not working

Version : master branch

After the installation of Bundler, in the step "Symlink ruby related binaries on the system path", the symlink to bundler failed.

TASK: [rvm_io.rvm1-ruby | Symlink ruby related binaries on the system path] ***
<10.0.2.5> ESTABLISH CONNECTION FOR USER: banh
<10.0.2.5> REMOTE_MODULE file owner=root group=root state=link src=/usr/local/rvm/wrappers/default/bundle dest=/usr/local/bin/bundle
<10.0.2.5> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/banh/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 10.0.2.5 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1448118244.89-227309662469466 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1448118244.89-227309662469466 && echo $HOME/.ansible/tmp/ansible-tmp-1448118244.89-227309662469466'
<10.0.2.5> PUT /tmp/tmpQ3V4xk TO /home/banh/.ansible/tmp/ansible-tmp-1448118244.89-227309662469466/file
<10.0.2.5> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/banh/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 10.0.2.5 /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=dkhrqaqlplibpeuyewqyzcdnidafpcgt] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-dkhrqaqlplibpeuyewqyzcdnidafpcgt; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/banh/.ansible/tmp/ansible-tmp-1448118244.89-227309662469466/file; rm -rf /home/banh/.ansible/tmp/ansible-tmp-1448118244.89-227309662469466/ >/dev/null 2>&1'"'"''
failed: [10.0.2.5] => (item=bundle) => {"failed": true, "item": "bundle", "path": "/usr/local/bin/bundle", "src": "/usr/local/rvm/wrappers/default/bundle", "state": "absent"}
msg: src file does not exist, use "force=yes" if you really want to create the link: /usr/local/rvm/wrappers/default/bundle

TASK: [rvm_io.rvm1-ruby | Install rubies] stucks

I have playbook:

roles:
  - role: rvm_io.rvm1-ruby
    rvm1_install_flags:       '--auto-dotfiles --user-install
    rvm1_install_path:        '/home/{{ ansible_ssh_user }}/.rvm'
    rvm1_rubies: 
      - '2.1.5'
    sudo:                     True
    rvm1_user:                'user'

I try to execute

ansible-playbook playbook.yml --ask-become-pass

and RVM log shows installation process stops and waits for password

...
...
...
++ sudo -p '%p password required for '\''apt-get --quiet --yes update'\'': ' apt-get --quiet --yes update

When I try to install ruby without

rvm1_user:                'user'

the Ruby installs fine, but TASK: [rvm_io.rvm1-ruby | Select default ruby] failed with Permission denied because ~/.rvm belongs to root

Permission denied when installing

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

GPG Key Issues During Fresh Deployment

Piggybacking on this issue: #16
I'm still having this issue on a clean box that doesn't have RVM installed or ruby installed at all. I manually pulled down the keys running the gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 commands for both root and my other user to test that. I get this:

gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net
gpg: key D39DC0E3: "Michal Papis (RVM signing) [email protected]" not changed
gpg: Total number processed: 1
gpg: unchanged: 1

This is on a clean server. Another server I already have this installed on works fine - I can rerun the role and it goes through and checks okay, I can also run the command and it gives the output above.

'apt-get install 'python-httplib2' ' failed: E: Could not open lock file /var/lib/dpkg/lock

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

FreeBSD support

I can't get this role to work with FreeBSD 10.1 running on ec2 with newly spun ami.

I get this:

TASK: [rvm_io.rvm1-ruby | Detect rvm binary] ********************************** 
fatal: [10.0.100.253] => Missing become password

FATAL: all hosts have already failed -- aborting

Relevant parts of the playbook:


---
- hosts: tag_env_ansiblelab:&tag_type_api
  remote_user: ec2-user
  become: yes
  become_method: su

  vars:
    ansible_python_interpreter: /usr/local/bin/python2.7
    rvm1_user: deploy
    rvm1_install_path: '/usr/home/deploy/.rvm'
    rvm1_install_flags: '--auto-dotfiles --user-install'

  pre_tasks:
    - pkgng: name=ca_root_nss state=present
    - pkgng: name=sudo state=present
    - pkgng: name=bash state=present
    - pkgng: name=gnupg state=present
    - user: name=deploy shell=/usr/local/bin/bash
    - name: Configure deploy sudoers file
      lineinfile: dest=/usr/local/etc/sudoers.d/deploy owner=root group=wheel mode=0440
                  line="deploy ALL=(ALL) NOPASSWD:ALL"
                  state=present
                  create=yes
                  validate='visudo -cf %s'

  tasks:
  - name: Bootstrap pkng
    raw: /usr/sbin/pkg -N
    register: pkg
    ignore_errors: True
  - raw: /usr/bin/env ASSUME_ALWAYS_YES=1 /usr/sbin/pkg bootstrap -f
    when: pkg|failed


  roles:
     - nginx
     - { role: rvm_io.rvm1-ruby, tags: ruby, sudo: True }

nginx does install fine.

task: detect stable rvm version fails

TASK: [nickjj.ruby | detect stable rvm version from url] **********************
failed: [10.0.2.11] => {"failed": true}
msg: httplib2 is not installed

I'm assuming this task shouldn't fail and the playbook should install the libs it needs right?

ruby 2.1.3 being set has default even though ruby-2.2.1 is being installed.

My playbook has these variables defined:

---
  vars:
    rvm1_rubies:
      - 'ruby-2.2.1'

Ruby 2.2.1 is being installed as it should, but when it comes time to set the default Ruby, for some reason Ruby 2.1.3 is being selected. As 2.1.3 isn't installed on the system, this breaks the rest of the playbook.

  • ansible 1.8.4
  • rvm1-ansible at aefe5b0
  • Installing on RHEL 7.1

Ansible log output with -vvvv (server name redacted): https://gist.github.com/matiaskorhonen/f98980dfa5aa369479bc

GPG key verification failed

I updated to version 1.3.1 of the playbook, but I am still receiving this error within Vagrant. Seems the "Import GPG keys" task is not running

TASK: [rvm_io.rvm1-ruby | Detect rvm binary] ********************************** 
<127.0.0.1> ESTABLISH CONNECTION FOR USER: vagrant
<127.0.0.1> REMOTE_MODULE stat path='/usr/local/lib/rvm/bin/rvm'
<127.0.0.1> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/chris/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'StrictHostKeyChecking=no', '-o', 'Port=2222', '-o', 'IdentityFile="/Users/chris/.vagrant.d/insecure_private_key"', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o', 'ConnectTimeout=10', '127.0.0.1', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1414596922.64-192939194049360 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1414596922.64-192939194049360 && echo $HOME/.ansible/tmp/ansible-tmp-1414596922.64-192939194049360'"]
<127.0.0.1> PUT /var/folders/qg/v9l_c749323g9fkrhz23hsq00000gq/T/tmpi2UW2q TO /home/vagrant/.ansible/tmp/ansible-tmp-1414596922.64-192939194049360/stat
<127.0.0.1> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/chris/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'StrictHostKeyChecking=no', '-o', 'Port=2222', '-o', 'IdentityFile="/Users/chris/.vagrant.d/insecure_private_key"', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o', 'ConnectTimeout=10', '127.0.0.1', u'/bin/sh -c \'sudo -k && sudo -H -S -p "[sudo via ansible, key=plbuzbhbuemsbnfdacphmadcacuusinc] password: " -u root /bin/sh -c \'"\'"\'echo SUDO-SUCCESS-plbuzbhbuemsbnfdacphmadcacuusinc; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1414596922.64-192939194049360/stat; rm -rf /home/vagrant/.ansible/tmp/ansible-tmp-1414596922.64-192939194049360/ >/dev/null 2>&1\'"\'"\'\'']
ok: [default] => {"changed": false, "stat": {"atime": 1414595175.9339015, "ctime": 1414101162.8497639, "dev": 2049, "exists": true, "gid": 1002, "inode": 140552, "isblk": false, "ischr": false, "isdir": false, "isfifo": false, "isgid": false, "islnk": false, "isreg": true, "issock": false, "isuid": false, "md5": "7b6ffc8b7d9e610d1600119e979c6c39", "mode": "0775", "mtime": 1414101156.414548, "nlink": 1, "pw_name": "root", "rgrp": true, "roth": true, "rusr": true, "size": 1440, "uid": 0, "wgrp": true, "woth": false, "wusr": true, "xgrp": true, "xoth": true, "xusr": true}}

TASK: [rvm_io.rvm1-ruby | Detect rvm installer] ******************************* 
<127.0.0.1> ESTABLISH CONNECTION FOR USER: vagrant
<127.0.0.1> REMOTE_MODULE stat path='/tmp/rvm-installer.sh'
<127.0.0.1> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/chris/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'StrictHostKeyChecking=no', '-o', 'Port=2222', '-o', 'IdentityFile="/Users/chris/.vagrant.d/insecure_private_key"', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o', 'ConnectTimeout=10', '127.0.0.1', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1414596922.8-80742544660849 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1414596922.8-80742544660849 && echo $HOME/.ansible/tmp/ansible-tmp-1414596922.8-80742544660849'"]
<127.0.0.1> PUT /var/folders/qg/v9l_c749323g9fkrhz23hsq00000gq/T/tmpXAytxY TO /home/vagrant/.ansible/tmp/ansible-tmp-1414596922.8-80742544660849/stat
<127.0.0.1> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/chris/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'StrictHostKeyChecking=no', '-o', 'Port=2222', '-o', 'IdentityFile="/Users/chris/.vagrant.d/insecure_private_key"', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o', 'ConnectTimeout=10', '127.0.0.1', u'/bin/sh -c \'sudo -k && sudo -H -S -p "[sudo via ansible, key=enuddnbogvorzdffxmoxzugveamhauls] password: " -u root /bin/sh -c \'"\'"\'echo SUDO-SUCCESS-enuddnbogvorzdffxmoxzugveamhauls; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1414596922.8-80742544660849/stat; rm -rf /home/vagrant/.ansible/tmp/ansible-tmp-1414596922.8-80742544660849/ >/dev/null 2>&1\'"\'"\'\'']
ok: [default] => {"changed": false, "stat": {"atime": 1414595353.0719852, "ctime": 1414595182.0689678, "dev": 2049, "exists": true, "gid": 0, "inode": 58191, "isblk": false, "ischr": false, "isdir": false, "isfifo": false, "isgid": false, "islnk": false, "isreg": true, "issock": false, "isuid": false, "md5": "ca657837bd4ededb7eb4ee10ce0b2802", "mode": "0644", "mtime": 1414595182.0689678, "nlink": 1, "pw_name": "root", "rgrp": true, "roth": true, "rusr": true, "size": 22371, "uid": 0, "wgrp": false, "woth": false, "wusr": true, "xgrp": false, "xoth": false, "xusr": false}}

TASK: [rvm_io.rvm1-ruby | Detect current rvm version] ************************* 
<127.0.0.1> ESTABLISH CONNECTION FOR USER: vagrant
<127.0.0.1> REMOTE_MODULE command /usr/local/lib/rvm/bin/rvm version
<127.0.0.1> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/chris/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'StrictHostKeyChecking=no', '-o', 'Port=2222', '-o', 'IdentityFile="/Users/chris/.vagrant.d/insecure_private_key"', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o', 'ConnectTimeout=10', '127.0.0.1', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1414596922.93-117344882954281 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1414596922.93-117344882954281 && echo $HOME/.ansible/tmp/ansible-tmp-1414596922.93-117344882954281'"]
<127.0.0.1> PUT /var/folders/qg/v9l_c749323g9fkrhz23hsq00000gq/T/tmpYm6tqy TO /home/vagrant/.ansible/tmp/ansible-tmp-1414596922.93-117344882954281/command
<127.0.0.1> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/chris/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'StrictHostKeyChecking=no', '-o', 'Port=2222', '-o', 'IdentityFile="/Users/chris/.vagrant.d/insecure_private_key"', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o', 'ConnectTimeout=10', '127.0.0.1', u'/bin/sh -c \'sudo -k && sudo -H -S -p "[sudo via ansible, key=dntiwpiutfoemkaovczerwjamzuarbfo] password: " -u root /bin/sh -c \'"\'"\'echo SUDO-SUCCESS-dntiwpiutfoemkaovczerwjamzuarbfo; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1414596922.93-117344882954281/command; rm -rf /home/vagrant/.ansible/tmp/ansible-tmp-1414596922.93-117344882954281/ >/dev/null 2>&1\'"\'"\'\'']
ok: [default] => {"changed": false, "cmd": ["/usr/local/lib/rvm/bin/rvm", "version"], "delta": "0:00:00.158156", "end": "2014-10-29 15:33:20.543296", "rc": 0, "start": "2014-10-29 15:33:20.385140", "stderr": "", "stdout": "rvm 1.25.34 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]", "stdout_lines": ["rvm 1.25.34 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]"]}

TASK: [rvm_io.rvm1-ruby | Install rvm installer] ****************************** 
skipping: [default]

TASK: [rvm_io.rvm1-ruby | Configure rvm installer] **************************** 
skipping: [default]

TASK: [rvm_io.rvm1-ruby | Import GPG keys] ************************************ 
skipping: [default]

TASK: [rvm_io.rvm1-ruby | Install rvm] **************************************** 
skipping: [default]

TASK: [rvm_io.rvm1-ruby | Update rvm] ***************************************** 
<127.0.0.1> ESTABLISH CONNECTION FOR USER: vagrant
<127.0.0.1> REMOTE_MODULE command /usr/local/lib/rvm/bin/rvm get stable && /usr/local/lib/rvm/bin/rvm reload #USE_SHELL
<127.0.0.1> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/chris/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'StrictHostKeyChecking=no', '-o', 'Port=2222', '-o', 'IdentityFile="/Users/chris/.vagrant.d/insecure_private_key"', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o', 'ConnectTimeout=10', '127.0.0.1', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1414596923.32-77930937418586 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1414596923.32-77930937418586 && echo $HOME/.ansible/tmp/ansible-tmp-1414596923.32-77930937418586'"]
<127.0.0.1> PUT /var/folders/qg/v9l_c749323g9fkrhz23hsq00000gq/T/tmpR2UAZM TO /home/vagrant/.ansible/tmp/ansible-tmp-1414596923.32-77930937418586/command
<127.0.0.1> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/chris/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'StrictHostKeyChecking=no', '-o', 'Port=2222', '-o', 'IdentityFile="/Users/chris/.vagrant.d/insecure_private_key"', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o', 'ConnectTimeout=10', '127.0.0.1', u'/bin/sh -c \'sudo -k && sudo -H -S -p "[sudo via ansible, key=teprlezjwpgbjhqiwyytjaxfwnislawa] password: " -u root /bin/sh -c \'"\'"\'echo SUDO-SUCCESS-teprlezjwpgbjhqiwyytjaxfwnislawa; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1414596923.32-77930937418586/command; rm -rf /home/vagrant/.ansible/tmp/ansible-tmp-1414596923.32-77930937418586/ >/dev/null 2>&1\'"\'"\'\'']
````failed: [default] => {"changed": false, "cmd": "/usr/local/lib/rvm/bin/rvm get stable && /usr/local/lib/rvm/bin/rvm reload", "delta": "0:01:11.675976", "end": "2014-10-29 15:34:33.953772", "rc": 2, "start": "2014-10-29 15:33:22.277796"}
stderr: gpg: Signature made Wed 29 Oct 2014 12:52:06 PM UTC using RSA key ID BF04FF17
gpg: Can't check signature: public key not found
gpg: Signature made Wed 29 Oct 2014 12:52:06 PM UTC using RSA key ID BF04FF17
gpg: Can't check signature: public key not found
Could not update RVM, get some help at #rvm IRC channel at freenode servers.
stdout: Downloading https://get.rvm.io
Downloading https://github.com/wayneeseguin/rvm/archive/1.26.0.tar.gz
Downloading https://github.com/wayneeseguin/rvm/releases/download/1.26.0/1.26.0.tar.gz.asc
GPG signature verification failed for '/usr/local/lib/rvm/archives/rvm-1.26.0.tgz' - 'https://github.com/wayneeseguin/rvm/releases/download/1.26.0/1.26.0.tar.gz.asc'!
try downloading the signatures:

    gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3

they can be compared with:

    https://rvm.io/mpapis.asc
    https://keybase.io/mpapis

Downloading https://bitbucket.org/mpapis/rvm/get/1.26.0.tar.gz
Downloading https://github.com/wayneeseguin/rvm/releases/download/1.26.0/1.26.0.tar.gz.asc
GPG signature verification failed for '/usr/local/lib/rvm/archives/rvm-1.26.0.tgz' - 'https://github.com/wayneeseguin/rvm/releases/download/1.26.0/1.26.0.tar.gz.asc'!
try downloading the signatures:

    gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3

they can be compared with:

    https://rvm.io/mpapis.asc
    https://keybase.io/mpapis

FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/Users/chris/site.retry

default                    : ok=17   changed=4    unreachable=0    failed=1   

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

is rvm installed?

I ran the rvm1-ansible role, after I started my virtual machine and typed in 'rvm' in the terminal, it outputted:

The program 'rvm' is currently not installed. You can install it by typing:
apt-get install ruby-rvm

is rvm installed?

Install hangs indefinitely when rvm needs to install ruby version not pre-compiled

We are using ruby-2.0.0 on Ubuntu Trusty for our ec2 machines. We've been experiencing a behavior where the ansible deployment hangs indefinitely even after rvm has finished installing ruby as a part of this command:

  • name: Install rubies
    command: '{{ rvm1_rvm }} install {{ item.item }} {{ rvm1_ruby_install_flags }}'
    when: rvm1_rubies and item.rc != 0
    with_items: detect_rubies.results
    sudo_user: '{{ rvm1_user }}'

Restarting ansible (after ensuring ruby was installed on the box manually) allows the deployment to continue to the next tasks.

Error bundler not found after 'rvm use ruby 2.2.2'

while trying to run bundle install, we get the error:

Error bundle not found

Apparently bundle isn't installed, but if you dig deeper, bundler gem is installed in default gemset - this is only available when you run "rvm use ruby-2.2.2" (for this scenario) but we need it in any gemset: "rvm use ruby@gemset" and this is achieved by installing bundler gem in the "@global" gemset that is inherited by all the gemsets on given ruby.
This is an update of #46
See PR #71

Ownership of .rvm directory when installing as user

So when I do an user wide installation, for example:

rvm1_install_flags: '--auto-dotfiles --user-install'
rvm1_install_path: '/home/deployer/.rvm'

The directory /home/deployer/.rvm is created successfully but with root as the owner. This behavior implies some issues, eg: when the user deployer tries to create gemsets inside the ~/.rvm/gems directory.

I'm working around this issue setting the ownership of the directory manually after the rvm installation:

name: rvm | set ownership of .rvm direcrory
shell: chown -R deployer {{rvm1_install_path}}

role fails with --check flag

Running a playbook with this role in --check mode seems to always fail. This is running against Ubuntu systems of different versions.

ansible 1.7.1

TASK: [rvm_io.rvm1-ruby | ensure rvm is upgraded] *****************************
fatal: [host_name] => error while evaluating conditional: rvm_binary.stat.exists and rvm_stable_version_number.content | default(rvm1_rvm_stable_version_number) | replace('\n', '') > rvm_current_version.stdout.split()[1]

Maybe I'm just missing something simple.

Error on upgrade

Similar issue as this? This happens when running against a box that used an older version of this galaxy role.

TASK: [rvm_io.rvm1-ruby | Update rvm] ***************************************** 
failed: [10.0.4.19] => {"changed": false, "cmd": "/usr/local/rvm/bin/rvm get stable && /usr/local/rvm/bin/rvm reload", "delta": "0:00:09.967174", "end": "2014-11-21 00:11:10.073133", "rc": 2, "start": "2014-11-21 00:11:00.105959"}
stderr: gpg: Signature made Tue 18 Nov 2014 01:09:57 AM UTC using RSA key ID BF04FF17
gpg: Good signature from "Michal Papis (RVM signing) <[email protected]>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 409B 6B17 96C2 7546 2A17  0311 3804 BB82 D39D C0E3
     Subkey fingerprint: 62C9 E5F4 DA30 0D94 AC36  166B E206 C29F BF04 FF17
In case of problems: http://rvm.io/help and https://twitter.com/rvm_io
  * No new notes to display.

/usr/local/rvm/bin/rvm: line 67: unexpected EOF while looking for matching `"'
/usr/local/rvm/bin/rvm: line 70: syntax error: unexpected end of file
stdout: Downloading https://get.rvm.io
Downloading https://github.com/wayneeseguin/rvm/archive/1.26.3.tar.gz
Downloading https://github.com/wayneeseguin/rvm/releases/download/1.26.3/1.26.3.tar.gz.asc
GPG verified '/usr/local/rvm/archives/rvm-1.26.3.tgz'

Upgrading the RVM installation in /usr/local/rvm/
Upgrade of RVM in /usr/local/rvm/ is complete.

# deploy,
#
#   Thank you for using RVM!
#   We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.


Upgrade Notes:

RVM reloaded!

FATAL: all hosts have already failed -- aborting

patch number must be included in rvm1_rubies?

While trying to install rvm for a local user with ansible, I get an error message.

  • role: rvm_io.rvm1-ruby
    sudo: yes
    rvm1_user: 'archief'
    rvm1_rvm_version: 'stable'
    rvm1_rvm_check_for_updates: false
    rvm1_gpg_keys: ''
    rvm1_rubies:
    - 'ruby-1.9.3'
    rvm1_install_flags: '--auto-dotfiles --user-install'
    rvm1_install_path: '/home/archief/.rvm'

output:
TASK: [rvm_io.rvm1-ruby | Install rubies] *************************************
changed: [172.22.25.227] => (item={u'cmd': [u'/home/archief/.rvm/bin/rvm', u'ruby-1.9.3', u'do', u'true'], u'end': u'2015-10-21 10:04:29.900201', u'stderr': u'Ruby ruby-1.9.3-p551 is not installed.', u'stdout': u'', u'changed': False, u'rc': 2, 'failed': False, 'item': 'ruby-1.9.3', u'delta': u'0:00:00.253186', 'invocation': {'module_name': u'command', 'module_args': u'/home/archief/.rvm/bin/rvm ruby-1.9.3 do true'}, 'stdout_lines': [], 'failed_when_result': False, u'start': u'2015-10-21 10:04:29.647015'})

TASK: [rvm_io.rvm1-ruby | Detect default ruby version] ************************
ok: [172.22.25.227]

TASK: [rvm_io.rvm1-ruby | Select default ruby] ********************************
changed: [172.22.25.227]

TASK: [rvm_io.rvm1-ruby | Install bundler if not installed] *******************
failed: [172.22.25.227] => (item=ruby-1.9.3) => {"changed": false, "cmd": "/home/archief/.rvm/wrappers/ruby-1.9.3/gem list | if ! grep "^bundler " ; then /home/archief/.rvm/wrappers/ruby-1.9.3/gem install bundler ; fi", "delta": "0:00:00.003083", "end": "2015-10-21 10:04:48.582447", "item": "ruby-1.9.3", "rc": 127, "start": "2015-10-21 10:04:48.579364", "stdout_lines": []}
stderr: /bin/sh: 1: /home/archief/.rvm/wrappers/ruby-1.9.3/gem: not found
/bin/sh: 1: /home/archief/.rvm/wrappers/ruby-1.9.3/gem: not found

FATAL: all hosts have already failed -- aborting

The reason that the gem executable is not found, is that the install task has installed it in wrappers/ruby-1.9.3@p551.
So I assume it is going to work when I change rvm1_rubies: 'ruby-1.9.3' to rvm1_rubies: 'ruby-1.9.3@p551'. But is this the way it is supposed to work? In examples, I see nowhere a mention of the patch number. Or should I fix this in another way?

regards, ruud

ruby version is not the expected one until I do "rvm reload"

After provisionning then ssh into my VM:

ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

rvm reload
Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-2.2.2/bin' is not available,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.2.2'.
RVM reloaded!

ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]

I guess the ruby version 1.8.x is installed from another role (I don't know which one), it's worth noting that I use zsh shell, not the default one.

My VM is based on Ubuntu 12.04.

How could I force rvm reload in order to always use the expected ruby version?

Thanks a lot

Reload shell

It would be nice if the shell could be reloaded when the playbook is applied
by the same user for which ruby should be installed.

How to install executable gem?

I can install executable gem with this command after installing rvm successfully:

rvm rubygems current

But how to do this with rvm1-ansible?

missing gemset with default ruby

When I ran the role, the default ruby didn't have gemset associated. So I was promoted to create a gemset without which I was not able to precede. If we could add a task to do this it would be great.

Getting error on rvm Symlink ruby related binaries task

TASK: [rvm_io.rvm1-ruby | Symlink ruby related binaries on the system path] ***
failed: [192.168.111.101] => (item=bundle) => {"failed": true, "gid": 0, "group": "root", "item": "bundle", "mode": "0755", "owner": "root", "path": "/usr/local/bin/bundle", "size": 498, "state": "file", "uid": 0}
msg: refusing to convert between file and link for /usr/local/rvm/wrappers/default/bundle
failed: [192.168.111.101] => (item=bundler) => {"failed": true, "gid": 0, "group": "root", "item": "bundler", "mode": "0755", "owner": "root", "path": "/usr/local/bin/bundler", "size": 499, "state": "file", "uid": 0}
msg: refusing to convert between file and link for /usr/local/rvm/wrappers/default/bundler
failed: [192.168.111.101] => (item=erb) => {"failed": true, "gid": 0, "group": "root", "item": "erb", "mode": "0755", "owner": "root", "path": "/usr/local/bin/erb", "size": 4844, "state": "file", "uid": 0}
msg: refusing to convert between file and link for /usr/local/rvm/wrappers/default/erb

ok: [192.168.111.101] => (item=executable-hooks-uninstaller)
failed: [192.168.111.101] => (item=gem) => {"failed": true, "gid": 0, "group": "root", "item": "gem", "mode": "0755", "owner": "root", "path": "/usr/local/bin/gem", "size": 548, "state": "file", "uid": 0}
msg: refusing to convert between file and link for /usr/local/rvm/wrappers/default/gem
failed: [192.168.111.101] => (item=irb) => {"failed": true, "gid": 0, "group": "root", "item": "irb", "mode": "0755", "owner": "root", "path": "/usr/local/bin/irb", "size": 192, "state": "file", "uid": 0}
msg: refusing to convert between file and link for /usr/local/rvm/wrappers/default/irb
failed: [192.168.111.101] => (item=rake) => {"failed": true, "gid": 0, "group": "root", "item": "rake", "mode": "0755", "owner": "root", "path": "/usr/local/bin/rake", "size": 485, "state": "file", "uid": 0}
msg: refusing to convert between file and link for /usr/local/rvm/wrappers/default/rake
failed: [192.168.111.101] => (item=rdoc) => {"failed": true, "gid": 0, "group": "root", "item": "rdoc", "mode": "0755", "owner": "root", "path": "/usr/local/bin/rdoc", "size": 940, "state": "file", "uid": 0}
msg: refusing to convert between file and link for /usr/local/rvm/wrappers/default/rdoc
failed: [192.168.111.101] => (item=ri) => {"failed": true, "gid": 0, "group": "root", "item": "ri", "mode": "0755", "owner": "root", "path": "/usr/local/bin/ri", "size": 190, "state": "file", "uid": 0}
msg: refusing to convert between file and link for /usr/local/rvm/wrappers/default/ri
failed: [192.168.111.101] => (item=ruby) => {"failed": true, "gid": 0, "group": "root", "item": "ruby", "mode": "0755", "owner": "root", "path": "/usr/local/bin/ruby", "size": 14307944, "state": "file", "uid": 0}
msg: refusing to convert between file and link for /usr/local/rvm/wrappers/default/ruby

I am trying in vertual machin with Ubuntu 14.04.3 LTS
getting this error

Role is broken by new RVM GPG Key validation

Hello,

RVM updated its install process by adding a GPG Key.
This does break the ansible role.

Here is the error:

failed: [default] => {"changed": false, "cmd": "/home/vagrant/.rvm/bin/rvm get stable && /home/vagrant/.rvm/bin/rvm reload", "delta": "0:00:55.607358", "end": "2014-10-29 10:15:04.945408", "rc": 1, "start": "2014-10-29 10:14:09.338050"}
stderr: gpg: directory `/home/vagrant/.gnupg' created
gpg: new configuration file `/home/vagrant/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/vagrant/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/vagrant/.gnupg/pubring.gpg' created
gpg: Signature made Wed 29 Oct 2014 12:14:56 AM UTC using RSA key ID BF04FF17
gpg: Can't check signature: public key not found
Could not update RVM, get some help at #rvm IRC channel at freenode servers.
stdout: Downloading https://get.rvm.io
Downloading https://github.com/wayneeseguin/rvm/archive/1.25.34.tar.gz
Downloading https://github.com/wayneeseguin/rvm/releases/download/1.25.34/1.25.34.tar.gz.asc

ERROR: GPG signature verification failed for '/home/vagrant/.rvm/archives/rvm-1.25.34.tgz' - 'https://github.com/wayneeseguin/rvm/releases/download/1.25.34/1.25.34.tar.gz.asc'!
try downloading the signatures:

    gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 BF04FF17

they can be compared with:

    https://rvm.io/mpapis.asc
    https://keybase.io/mpapis

FATAL: all hosts have already failed -- aborting

In order to make it work again it will be perfect if you could add this command before executing the role:

gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 BF04FF17

Thank you.

install rvm installer fails

After successfully installing rvm on a test server with rvm1-ansible, I tried to do the same on another machine (the same ubuntu version)

This fails with
TASK: [rvm_io.rvm1-ruby | Detect rvm installer] *******************************
ok: [host.nl] => {"changed": false, "stat": {"exists": false}}

TASK: [rvm_io.rvm1-ruby | Detect current rvm version] *************************
skipping: [host.nl]

TASK: [rvm_io.rvm1-ruby | Install rvm installer] ******************************
failed: [host.nl] => {"failed": true}
msg: Failed to validate the SSL certificate for raw.githubusercontent.com:443. Make sure your managed systems have a valid CA certificate installed. If the website serving the url uses SNI you need python >= 2.7.9 on your managed machine. You can use validate_certs=False if you do not need to confirm the server\s identity but this is unsafe and not recommended Paths checked for this platform: /etc/ssl/certs, /etc/pki/ca-trust/extracted/pem, /etc/pki/tls/certs, /usr/share/ca-certificates/cacert.org, /etc/ansible

Googling around, I found an advice to upgrade to ansible 1.9, which I did, but this results in exactly the same message.

$ ansible-playbook --version
ansible-playbook 1.9.4

I hope you can help me out.
Ruud

Allow setting default-used Ruby

Can we have an rvm1_default_ruby? Right now, the one that gets used by default seems to be somewhat random. I installed 2.1.3 and 1.9.3 and the 1.9.3 got used.

rvm1_rvm_latest_installer should point to rvm/rvm

From defaults/main.yml:

# URL for the latest installer script
rvm1_rvm_latest_installer: 'https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer'

Since rvm has moved, this should point to the new location.

Problem adding new gemset

Thanks for this role, I suppose that I'm doing something wrong, the role is well installed and rvm works, when I ssh to the machine.

I can also install a ruby inside the playbook:

  • name: Installing ruby
    shell: "/usr/local/rvm/bin/rvm install 2.1.6"
    It works well

The problem is when I try to create a gemset:

  • name: Preparing gemsets
    shell: "/usr/local/rvm/bin/rvm use 2.1.6@antifraud-gemset --create --default"

Give always the same warning as a result the gemset is not installed:

changed: [172.17.8.150] => {"changed": true, "cmd": "/usr/local/rvm/bin/rvm use 2.1.6@antifraud-gemset --create --default", "delta": "0:00:00.170817", "end": "2015-11-06 12:09:09.339580", "rc": 0, "start": "2015-11-06 12:09:09.168763", "stderr": "RVM is not a function, selecting rubies with 'rvm use ...' will not work.\n\nYou need to change your terminal emulator preferences to allow login shell.\nSometimes it is required to use /bin/bash --login as the command.\nPlease visit https://rvm.io/integration/gnome-terminal/ for an example.", "stdout": "", "warnings": []}

Switch to ruby version

When there is another role/playbook/external ansible code that should install a gem,
how can it easily switch to a ruby version to use its gem command?
Does this role offer a command or shortcut for this?

Gems installed by root user lands in `/root/.gem`

I install some ruby with this dependency:

---
dependencies:
  - role: rvm_io.rvm1-ruby
    rvm1_rubies:
      - ruby-2.0.0-p643
    rvm1_default_ruby_version: ruby-2.0.0-p643

and later on install a gem with following task:

- name: install backup gem
  tags: focus
  gem: name=backup version=4.2 state=present executable=/usr/local/rvm/rubies/ruby-2.0.0-p643/bin/gem

them gem lands into /root/.gem/ruby/2.0.0/gems/ instead of rvm's path. There is only a wrapper in /usr/local/rvm for backup binary.

I've tried with manually overriding environment like this:

  environment:
    PATH: "/usr/local/rvm/gems/{{default_ruby}}/bin:/usr/local/rvm/gems/{{default_ruby}}@global/bin:/usr/local/rvm/rubies/{{default_ruby}}/bin:{{ansible_env.PATH}}"
    GEM_HOME: /usr/local/rvm/gems/{{default_ruby}}
    GEM_PATH: /usr/local/rvm/gems/{{default_ruby}}:/usr/local/rvm/gems/{{default_ruby}}@global

but without any luck.

Is it even possible to use gem_module to install gems for rvm rubies? Or i should fallback to some shell: with creates: trickery?

Thanks for any help!

My versions:

ansible 1.9.3
rvm1-ansible v1.3.7

rvm_rubies must be specified via `ruby-`

  • If you specify 2.2.3:
    • It will install the ruby and set it as default okay
    • It will fail to install bundler: /usr/local/rvm/wrappers/2.2.3/gem not found
  • If you specify ruby-2.2.3:
    • It uses the correct path: /usr/local/rvm/wrappers/ruby-2.2.3/gem

Not sure if a note it the docs should point that out, or the playbook itself should adjust the input if needed, but thought I'd point it out in case anyone else bumps into it.

Recursing through ~/.rvm directory to verify permission is expensive

Given that there's ~700MB of Gems already installed in ~/.rvm, this operation is pretty expensive:

https://github.com/rvm/rvm1-ansible/blob/master/tasks/main.yml

- name: ensure rvm install path is writable by the set owner:group
  file: path='{{ rvm1_install_path }}' state=directory recurse=yes owner='{{ rvm1_user }}' group='{{ rvm1_group }}'

(I do notice it more because this is done in a VirtualBox where the I/O is poor and it takes a minute or two to complete).

Curl Dependency (Ubuntu)

I'm new to ansible, so forgive me if I'm missing something obvious.

With the standard Vagrant Ubuntu 12.04 image (at least), curl is not installed by default, so rvm installation fails. If I add an apt pkg state=installed for curl to tasks/debian.yml, everything works fine.

Should curl be a dependency (at least for Debian-based systems)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.