jobscore.beats
角色名称
此角色在 Ubuntu 机器上安装 Beats 产品。
此角色能够安装作为 deb 包提供的 Beats 产品。然而,目前仅支持以下两个产品的配置(例如 filebeat.yml, metricbeat.yml):
- filebeat
- metricbeat
要求
无
角色变量
您需要通过 beats_version
变量指定要安装的 Beats 产品版本(默认:6.7.2)。
beats_version: 6.7.2
您还需要在一个名为 beats_products
的列表变量中指定要安装的产品(默认:[]):
beats_products:
- filebeat
- metricbeat
如果您希望在 APT 上保持 Beats 包的版本不被更新(默认:true),可以使用 beats_hold_products
变量:
beats_hold_products: true
如果您希望实时配置产品,您需要创建一个变量,名称为产品名后加 _config:
,该变量应该是一个包含您选择的产品 YAML 配置的字典。示例:
filebeat_config:
filebeat.modules:
- module: system
syslog:
enabled: true
output.logstash.hosts:
- logstash.server:5044
metricbeat_config:
metricbeat.modules:
- module: system
metricsets: ["cpu","memory","network"]
enabled: true
period: 15s
processes: ['.*']
output.logstash.hosts:
- logstash.server:5044
配置的具体值在 Beats 文档中有详细描述。
依赖
没有依赖项。
示例剧本
包括一个如何使用您角色的示例(例如,作为参数传递的变量)对用户来说总是很有帮助:
- hosts: servers
become: true
roles:
- role: jobscore.beats
beats_version: 6.7.2
beats_products:
- filebeat
- metricbeat
filebeat_config:
filebeat.modules:
- module: system
syslog:
enabled: true
output.logstash.hosts:
- logstash.server:5044
metricbeat_config:
metricbeat.modules:
- module: system
metricsets: ["cpu","memory","network"]
enabled: true
period: 15s
processes: ['.*']
output.logstash.hosts:
- logstash.server:5044
许可证
GPLv3
作者信息
此角色由 Eric Magalhães 创建。