LoginSignup
7
8

More than 5 years have passed since last update.

Ansibleを使ってFluentdのプラグインをインストールする

Posted at

Ansibleを使ってFluentdのプラグインをインストールしたい

Fluentdのプラグインインストールにはtd-agent-gemを使ってインストールする。
Ansible Moduleのcommandshellからtd-agent-gemプラグインをインストールしても良いのだが、如何せんかっこ悪いし、changed_whenとかの制御が面倒くさい・・・。

じゃあどうするの

Ansible Moduleにgemといものがある。
こいつを使ってインストールすれば余計な事を考えず、冪等性も担保されるね。

サンプルコード

- name: install plugin
  gem:
    executable: /usr/sbin/td-agent-gem
    name: hoge-gem
    state: present
    user_install: no
    version: 1.0.0

executableを指定すると、実行するgemコマンドのパスをオーバーライドしてくれる。
これを使えば、楽チンダネー。

7
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
8