main.yml 956 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: "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: 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: "{{ group }}.yml"
    dest: "/etc/filebeat/filebeat-{{ group }}.yml"
  notify:
    - restart filebeat