rvm install succeeds, but Ansible fails

I have this task in a playbook:

  • name: install ruby 2.1.0

rvm: ruby=2.1.0

It causes the following error, with no real explanation. Yet, when I check on the remote machine, it seems to have installed fine. Also, on the remote machine, I can easily uninstall and install it. And when I install it, the output is exactly what I see with ansible, and the exit code is zero. So why does it fail?

failed: [rubyhost] => {“failed”: true, “item”: “”, “rc”: 1}

msg: RVMError: code=1, command=rvm install 2.1.0, output=Searching for binary rubies, this might take some time.
Found remote file https://rvm.io/binaries/ubuntu/12.04/x86_64/ruby-2.1.0.tar.bz2
Checking requirements for ubuntu.
Requirements installation successful.
ruby-2.1.0 - #configure
ruby-2.1.0 - #download
ruby-2.1.0 - #validate archive
ruby-2.1.0 - #extract
ruby-2.1.0 - #validate binary
ruby-2.1.0 - #setup
ruby-2.1.0 - #making binaries executable.
ruby-2.1.0 - #downloading rubygems-2.2.2
ruby-2.1.0 - #extracting rubygems-2.2.2.
ruby-2.1.0 - #removing old rubygems.
ruby-2.1.0 - #installing rubygems-2.2.2…
ruby-2.1.0 - #gemset created /usr/local/rvm/gems/ruby-2.1.0@global
ruby-2.1.0 - #importing gemset /usr/local/rvm/gemsets/global.gems…
ruby-2.1.0 - #generating global wrappers.
ruby-2.1.0 - #gemset created /usr/local/rvm/gems/ruby-2.1.0
ruby-2.1.0 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.1.0 - #generating default wrappers.

Unfortunately the rvm module is not part of the core modules we ship with Ansible, so unless someone else on the list is familiar with it you may need to contact the original author.

Also, a bit of a follow up, the rvm module that was a pull request (was this it?) was submitted a very long time ago.

If there is a good need for a module to install rvm, I’m open to it, though it also seems like maybe shell+async is still the right way to go?