---
- name: Logstash installed
  community.general.pkgng:
    name: "logstash7"
    state: latest

- name: Logstash enabled
  shell: sysrc logstash_enable="YES"

- name: Logstash config file installed
  copy:
    src: logstash.yml
    dest: /usr/local/etc/logstash/logstash.conf
    owner: root
    mode: 0664
  notify: Logstash restarted

- name: Logstash config file installed
  copy:
    src: pipeline.conf
    dest: /usr/local/etc/logstash/pipeline.conf
    owner: root
    mode: 0664
  notify: Logstash restarted

- name: Logstash started
  service: name=logstash state=started
