main.yml
1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
# tasks file for filebeat
# make sure user type YES
- name: "make sure user type YES to confirm"
fail:
msg: "user do not type YES"
when: confirmation != 'YES'
- name: "Create elastic yum repo file"
copy:
src: "elastic.repo"
dest: "/etc/yum.repos.d/elastic.repo"
# install filebeat
- name: ensure filebeat is installed
yum:
name: filebeat
state: installed
update_cache: yes
- name: disable filebeat service
service: name=filebeat state=stopped
- name: Clean nginx-access folder
shell: rm -rf /usr/share/filebeat/bin/data/nginx-access
notify:
- restart filebeat
- name: replace filebeat binary file with version 5.6.4
copy:
src: "filebeat-5.6.4"
dest: "/usr/share/filebeat/bin/filebeat"
mode: 0755
notify:
- restart filebeat-base
- restart filebeat
- name: update filebeat base configuration file
template:
src: "base.yml"
dest: "/etc/filebeat/filebeat-base.yml"
notify:
- restart filebeat-base
- name: update filebeat configuration file
template:
src: "{{ config_group }}.yml"
dest: "/etc/filebeat/filebeat-{{ config_group }}.yml"
notify:
- restart filebeat