---
- name: Filebeat package installed
  community.general.pkgng:
    name: "beats7"
    state: latest

- name: Filebeat enabled
  shell: sysrc filebeat_enable="YES"
  notify: Filebeat restarted

- name: Filebeat config installed
  copy:
    src: filebeat.yml
    dest: /usr/local/etc/beats/filebeat.yml
    owner: root
    mode: 0644
  notify: Filebeat restarted
  tags:
    - filebeat-config

- name: Filebeat started
  service: name=filebeat state=started
