---

- block:
  - name: create project directory
    file:
      path: /etc/docker-compose/logstash
      state: directory

  - name: copy docker-compose.yml
    template:
      src: docker-compose.yml
      dest: /etc/docker-compose/logstash/docker-compose.yml

  - name: copy config
    copy:
      src: config
      dest: /etc/docker-compose/logstash/
    notify: restart logstash

  - name: copy pipeline
    copy:
      src: pipeline
      dest: /etc/docker-compose/logstash/
    notify: restart logstash

  - name: start logstash
    docker_service:
      project_src: /etc/docker-compose/logstash
      state: present

  become: yes
