main.yml 1010 Bytes
---
# 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: Init filebeat folders
  shell: mkdir -p /etc/filebeat /Data/logs/filebeat

- name: ensure filebeat is uninstalled
  yum:
    name: filebeat
    state: absent

- name: replace filebeat binary file with version 5.6.4
  copy:
    src: "filebeat-5.6.4"
    dest: "/usr/sbin/filebeat"
    mode: 0755
  notify:
    - restart filebeat-base
    - restart filebeat

- name: Clean nginx-access folder
  shell: rm -rf /usr/share/filebeat/bin/data/nginx-access
  notify:
    - 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