2016-11-17 16:17:35 +01:00
|
|
|
---
|
|
|
|
|
2017-05-21 11:13:48 +02:00
|
|
|
- name: Install Elastic sources list
|
|
|
|
include_role:
|
2017-05-21 12:14:31 +02:00
|
|
|
name: elastic-sources-list
|
2017-05-21 11:13:48 +02:00
|
|
|
|
2016-11-17 16:17:35 +01:00
|
|
|
- name: Filebeat is installed
|
|
|
|
apt:
|
|
|
|
name: filebeat
|
2017-01-12 17:37:48 +01:00
|
|
|
state: present
|
2016-11-17 16:17:35 +01:00
|
|
|
tags:
|
|
|
|
- packages
|
|
|
|
|
|
|
|
- name: Filebeat service is enabled
|
|
|
|
service:
|
|
|
|
name: filebeat
|
|
|
|
enabled: yes
|
|
|
|
|
2016-11-22 16:43:45 +01:00
|
|
|
# - name: Kibana dashboards are imported
|
|
|
|
# command: /usr/share/filebeat/scripts/import_dashboards
|
|
|
|
# when: filebeat_kibana_dashboards
|
2016-11-17 16:17:35 +01:00
|
|
|
|
|
|
|
- name: is logstash-plugin available?
|
|
|
|
stat:
|
|
|
|
path: /usr/share/logstash/bin/logstash-plugin
|
2017-03-24 14:15:09 +01:00
|
|
|
check_mode: no
|
2016-11-17 16:17:35 +01:00
|
|
|
register: logstash_plugin
|
|
|
|
|
2016-11-22 16:43:45 +01:00
|
|
|
- name: is logstash-input-beats installed?
|
2017-05-19 22:31:17 +02:00
|
|
|
command: grep logstash-input-beats /usr/share/logstash/Gemfile
|
2017-03-24 14:15:09 +01:00
|
|
|
check_mode: no
|
2016-11-22 16:43:45 +01:00
|
|
|
register: logstash_plugin_installed
|
|
|
|
failed_when: false
|
|
|
|
changed_when: false
|
2016-11-17 16:17:35 +01:00
|
|
|
when: filebeat_logstash_plugin and logstash_plugin.stat.exists
|
2016-11-22 16:43:45 +01:00
|
|
|
|
|
|
|
- block:
|
2017-01-12 16:23:42 +01:00
|
|
|
- name: Check if /usr is a partition
|
|
|
|
shell: "mount | grep 'on /usr type'"
|
|
|
|
args:
|
|
|
|
warn: no
|
|
|
|
changed_when: False
|
|
|
|
failed_when: False
|
2017-03-24 14:15:09 +01:00
|
|
|
check_mode: no
|
2017-01-12 16:23:42 +01:00
|
|
|
register: usr_partition
|
|
|
|
|
|
|
|
- name: Mount /usr in rw
|
|
|
|
command: mount -o remount,rw /usr
|
|
|
|
args:
|
|
|
|
warn: no
|
|
|
|
changed_when: False
|
|
|
|
when: usr_partition.rc == 0
|
2016-11-22 16:43:45 +01:00
|
|
|
|
|
|
|
- name: Logstash plugin is installed
|
|
|
|
command: /usr/share/logstash/bin/logstash-plugin install logstash-input-beats
|
|
|
|
|
|
|
|
- name: /usr is remounted
|
|
|
|
command: mount -oremount /usr
|
2017-01-12 16:23:42 +01:00
|
|
|
args:
|
|
|
|
warn: no
|
|
|
|
changed_when: False
|
2017-05-19 22:52:33 +02:00
|
|
|
when: usr_partition.rc == 0
|
|
|
|
when:
|
|
|
|
- filebeat_logstash_plugin
|
|
|
|
- logstash_plugin.stat.exists
|
|
|
|
- not logstash_plugin_installed | success
|