Role name in Ansible Galaxy: williamyeh.fluentd
This Ansible role has the following features for Fluentd:
- Install td-agent: the stable distribution of Fluentd.
- Install several plugins.
- Bare bone configuration (real configuration should be left to user's template files; see Usage section below).
Variables needed to be defined in user's playbook: None.
User-configurable defaults:
# an array of plugins to be installed
tdagent_plugins
# conf file (usually td-agent.conf) to be installed,
# relative to `playbook_dir`;
# the file will be copied verbatim
tdagent_conf_copy
# conf file (usually td-agent.conf.j2) to be installed,
# relative to `playbook_dir`;
# the file will be copied through Ansible's template system
tdagent_conf_template
-
restart td-agent
-
stop td-agent
Add role name williamyeh.fluentd
to your playbook file.
Set vars in your playbook file.
Simple example:
---
# file: simple-playbook.yml
- hosts: all
roles:
- williamyeh.fluentd
vars:
tdagent_plugins:
- fluent-plugin-watch-process
- fluent-plugin-multiprocess
- fluent-plugin-elasticsearch
More practical example:
---
# file: complex-playbook.yml
- hosts: all
roles:
- williamyeh.fluentd
vars:
tdagent_plugins:
- fluent-plugin-watch-process
- fluent-plugin-multiprocess
- fluent-plugin-elasticsearch
# copy verbatim
tdagent_conf_copy: "files/td-agent.conf"
# copy through Ansible's template system
tdagent_conf_template: "templates/td-agent.conf.j2"
None.
Licensed under the MIT License. See the LICENSE file for details.
Modified from my Dockerized Fluentd app: