gem module and gem executable path

Hi all. Trying to bootstrap centos 6.4 based servers.

So I’ve got a simple task;

  • name: install bundler
    gem: name=bundler state=present

And its failing because;
Because msg: Failed to find required executable gem

Now the reason for this is that my gem executable is in /usr/local/bin

So, how to overcome this?

3 things,

patch the gem module to support an alternate path for the gem binary
use the /etc/alternatives approach
call the gem command directly with the command or shell module

  • James

The first one seems best to me, though you may also consider using the “environment” keyword in ansible to set the path.

though I like option 1.

Send me a pull request and I’ll gladly take it. The parameter should be called gem_path, I’d think.

Or four;)

Change sudoers Defaults secure_path to include /usr/local/bin

tiistai, 2. heinäkuuta 2013 21.32.05 UTC+3 James Martin kirjoitti:

Hello Michael,

I implemented option 1 in this pull request:
https://github.com/ansible/ansible/pull/4497

This is my first Python code since probably … 10 years :slight_smile:
Please, let me know if you need any changes.

Kind regards,

Thanks, see comment on the ticket!