---

- hosts: localhost
  become: true


  tasks:

  - name: Change the Packetbeat configuration
    template: src=templates/packetbeat.yml dest=/etc/packetbeat/packetbeat.yml

  - name: Start Packetbeat
    service: name=packetbeat state=restarted

  - debug: msg="Test with curl -XGET 'http://localhost:9200/packetbeat-*/_search?pretty'"

---

- hosts: localhost
  become: true


  tasks:

  - name: Explicitly PUT the Packetbeat mapping, since it doesn't happen automatically via Redis
    command: curl -XPUT --data-binary @/etc/packetbeat/packetbeat.template.json localhost:9200/_template/packetbeat

  - name: Change the Packetbeat configuration
    template: src=templates/packetbeat.yml dest=/etc/packetbeat/packetbeat.yml

  - name: Start Packetbeat
    service: name=packetbeat state=restarted

  - debug: msg="Test with curl -XGET 'http://localhost:9200/packetbeat-*/_search?pretty'"

FIX missing Packetbeat mapping, which breaks the Kibana visualization
FIX missing Packetbeat mapping, which breaks the Kibana visualization
