Hi all-
I was hoping that someone has some advice for using the “gem” module with rbenv.
I’m trying to install the “whenever” gem into rbenv’s global ruby, but it’s not ending up in the correct location. My playbook looks like this:
- name: install the whenever gem
gem:
name: whenever
state: present
executable: “~/.rbenv/shims/gem”
become_user: deploy
When I run this task, the gem ends up getting installed under ~/.gem/ruby/2.2.0/gems instead of ~/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems.
I’ve also tried using executable=“~/.rbenv/bin/rbenv exec gem” to no avail.
Has anyone dealt with this problem while still being able to use the “gem” module? I’ve found places where people have tried to use the “shell” module with “bash -lc” instead, but I’d rather avoid that since it looses the ability to detect the “changed” status easily.
Forgive me if I should be asking the rbenv folks about this, but I figured it was a toss-up since they quite possibly would have told me to ask the Ansible folks. I’m hoping the Ansible user community has more experience with making this work correctly.
If it matters, I’m running Ansible 1.9.4.
Thanks.
-md