91 lines
2 KiB
YAML
91 lines
2 KiB
YAML
---
|
|
|
|
- name: APT https transport is enabled
|
|
apt:
|
|
name: apt-transport-https
|
|
state: present
|
|
tags:
|
|
- filebeat
|
|
- packages
|
|
|
|
- name: Elastic GPG key is installed
|
|
apt_key:
|
|
# url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
|
|
data: "{{ lookup('file', 'elasticsearch.key') }}"
|
|
state: present
|
|
tags:
|
|
- filebeat
|
|
- packages
|
|
|
|
- name: Elastic sources list is available
|
|
apt_repository:
|
|
repo: "deb https://artifacts.elastic.co/packages/5.x/apt stable main"
|
|
filename: elastic.list
|
|
state: present
|
|
update_cache: yes
|
|
tags:
|
|
- filebeat
|
|
- packages
|
|
|
|
- name: Filebeat is installed
|
|
apt:
|
|
name: filebeat
|
|
state: present
|
|
tags:
|
|
- filebeat
|
|
- packages
|
|
|
|
- name: Filebeat service is enabled
|
|
service:
|
|
name: filebeat
|
|
enabled: yes
|
|
|
|
# - name: Kibana dashboards are imported
|
|
# command: /usr/share/filebeat/scripts/import_dashboards
|
|
# when: filebeat_kibana_dashboards
|
|
|
|
- name: is logstash-plugin available?
|
|
stat:
|
|
path: /usr/share/logstash/bin/logstash-plugin
|
|
check_mode: no
|
|
register: logstash_plugin
|
|
|
|
- name: is logstash-input-beats installed?
|
|
command: grep logstash-input-beats /usr/share/logstash/Gemfile
|
|
check_mode: no
|
|
register: logstash_plugin_installed
|
|
failed_when: false
|
|
changed_when: false
|
|
when: filebeat_logstash_plugin and logstash_plugin.stat.exists
|
|
|
|
- block:
|
|
- name: Check if /usr is a partition
|
|
shell: "mount | grep 'on /usr type'"
|
|
args:
|
|
warn: no
|
|
changed_when: False
|
|
failed_when: False
|
|
check_mode: no
|
|
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
|
|
|
|
- name: Logstash plugin is installed
|
|
command: /usr/share/logstash/bin/logstash-plugin install logstash-input-beats
|
|
|
|
- name: /usr is remounted
|
|
command: mount -oremount /usr
|
|
args:
|
|
warn: no
|
|
changed_when: False
|
|
when: usr_partition.rc == 0
|
|
when:
|
|
- filebeat_logstash_plugin
|
|
- logstash_plugin.stat.exists
|
|
- not logstash_plugin_installed | success
|