ansible gem not installing dependencies

Hi there,

I tried to install fluentd elasticsearch plugin using ansible gem, however for some reason the installation does not install the dependencies even though i explicitly set to install dependencies

Background:

Trying the following code result with success, however the td-agent service can’t start because it is missing some dependencies

gem: name=fluent-plugin-elasticsearch state=present executable=/opt/td-agent/embedded/bin/fluent-gem include_dependencies=yes

When starting the service ,receive error

`
fluent/supervisor.rb:257:rescue in main_process: config error file=“/etc/td-agent/td-agent.conf” error=“Unknown output plugin ‘elasticsearch’. Run ‘gem search -rd fluent-plugin’ to find plugins”

`

However if i execute it using standard command (below) , i don’t encounter the problem

command: /opt/td-agent/embedded/bin/fluent-gem install fluent-plugin-elasticsearch

How do i know it is missing dependencies? When i see the gem list under td-agent directory (/opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/) no elasticsearch listed there when installing using “ansible gem” . if i try to install elasticsearch using “ansible gem” it will complain it is missing other fluentd plugins.

Is this problem with gem plugin ? or can anyone shed any light on this?

Thanks,

​Really weird, after tinkering i got it working by adding “user_install=no” . The gem executable is slightly different

`

gem: name=fluent-plugin-elasticsearch state=present executable=/usr/sbin/td-agent-gem user_install=no​
`

For some reason without user install option , i found that the gem was installed under root home directory. Shouldn’t by default it install it system wide?

“For some reason without user install option , i found that the gem was installed under root home directory. Shouldn’t by default it install it system wide?”

I would hope so, yes.

Perhaps this is something about that particular gem?

I’m having the same issue with beanstalkd_view
gem: name=beanstalkd_view user_install=no include_dependencies=yes state=present

will not install dependencies of beanstalkd_view.
Ubuntu 14.04LTS and the ansible 1.9.2

I just figured it out. The existence of /root/.gems that met the dependencies of beanstalkd_view is what caused the issue. Gem thought the dependencies were met eventhough they were not when it was installing system wide in /var/lib/gems. I think the default for user_install should be false (system wide should be the default). That is why I had packages installed in root’s home directory to begin with. Removing the directory /root/.gems solved the problem.