Filebeat role

This commit is contained in:
Jérémy Lecour 2016-11-17 16:17:35 +01:00 committed by Jérémy Lecour
parent c51b29fb05
commit 6a7f8ebe6d
4 changed files with 69 additions and 3 deletions

12
filebeat/README.md Normal file
View file

@ -0,0 +1,12 @@
# filebeat
Install Filebeat.
## Tasks
Everything is in the `tasks/main.yml` file.
## Available variables
* `filebeat_kibana_dashboards`: import dashboards in Kibana (defaults to false).
* `filebeat_logstash_plugin`: install Logstash plugin (defaults to false);

View file

@ -0,0 +1,2 @@
filebeat_kibana_dashboards: False
filebeat_logstash_plugin: False

52
filebeat/tasks/main.yml Normal file
View file

@ -0,0 +1,52 @@
---
- name: APT https transport is enabled
apt:
name: apt-transport-https
state: installed
tags:
- system
- packages
- name: Elastic GPG key is installed
apt_key:
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
state: present
tags:
- system
- packages
- name: Elastic sources list is available
apt_repository:
repo: "deb https://artifacts.elastic.co/packages/5.x/apt stable main"
state: present
tags:
- system
- packages
- name: Filebeat is installed
apt:
name: filebeat
update_cache: yes
state: installed
tags:
- packages
- name: Filebeat service is enabled
service:
name: filebeat
enabled: yes
- name: Kibana dashboards are imported
command: /usr/share/filebeat/scripts/import_dashboards
failed_when: '"fail" in stdout'
when: filebeat_kibana_dashboards
- name: is logstash-plugin available?
stat:
path: /usr/share/logstash/bin/logstash-plugin
register: logstash_plugin
- name: Logstash plugin is installed
command: /usr/share/logstash/bin/logstash-plugin install logstash-input-beats
when: filebeat_logstash_plugin and logstash_plugin.stat.exists

View file

@ -5,8 +5,8 @@
roles:
# - { role: apt-upgrade, apt_upgrade_mode: safe }
- apt-upgrade
- apt-backports
# - apt-upgrade
# - apt-backports
# - munin
# - monit
# - redis
@ -24,4 +24,4 @@
# - { role: elasticsearch, elasticsearch_custom_tmpdir: "/var/lib/elasticsearch/tmp" }
# - elasticsearch
# - elasticsearch-plugin-head
- kibana
- filebeat