summaryrefslogtreecommitdiff
path: root/roles/filebeat/tasks/main.yml
blob: 50fb7a161ab5c495bfd1affff665b5106f24382b (plain)
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
---
- name: add elastic.co GPG pkg key
  apt_key:
    url: https://artifacts.elastic.co/GPG-KEY-elasticsearch

- name: add beats repository
  apt_repository:
    repo: "deb https://artifacts.elastic.co/packages/6.x/apt stable main"
    state: present
    update_cache: yes

# stick to version 6.2.4 explicitly.  Upgrading past this will
#  require config file changes and will generate parse errors
#  logstash
- name: install filebeat
  apt:
    name: filebeat=6.2.4
    state: present
    update_cache: yes
  notify:
    - restart filebeat

- name: copy filebeat cert
  copy:
    src: "{{secrets_dir}}/files/elk/{{logstash_cert}}"
    dest: "/etc/filebeat/{{logstash_cert}}"

- name: install customized module configs
  template:
    src: "{{item}}.j2"
    dest: /etc/filebeat/modules.d/{{item}}
  with_items:
    - apache2.yml
    - system.yml

- name: create filebeat.yml
  template:
    src: filebeat.yml.j2
    dest: /etc/filebeat/filebeat.yml
    force: yes
  notify:
    - restart filebeat