---

- hosts: localhost
  become: true
  vars_files:
    - vars.yml



  tasks:

  - name: Load the Filebeat dashboard
    command: /usr/share/filebeat/scripts/import_dashboards

  - name: >
      Load the Heartbeat dashboard
      Use the nightlies since the dashboard is only available on master ATM
    command: /usr/share/heartbeat/scripts/import_dashboards --url https://beats-nightlies.s3.amazonaws.com/dashboards/beats-dashboards-6.0.0-alpha1-SNAPSHOT.zip

  - name: Load the Metricbeat dashboard
    command: /usr/share/metricbeat/scripts/import_dashboards

  - name: Load the Packetbeat dashboard
    command: /usr/share/packetbeat/scripts/import_dashboards

  - name: Add a default index pattern using Metricbeat
    command: >
      curl -XPUT http://localhost:9200/.kibana/config/{{ elastic_version }} -d '{"defaultIndex" : "metricbeat-*"}'


---

- hosts: localhost
  become: true
  vars_files:
    - vars.yml


  tasks:

  - name: Load the Filebeat dashboard
    command: /usr/share/filebeat/scripts/import_dashboards -file /opt/dashboards.zip

  - name: Load the Heartbeat dashboard
    command: /usr/share/heartbeat/scripts/import_dashboards -file /opt/dashboards.zip

  - name: Load the Metricbeat dashboard
    command: /usr/share/metricbeat/scripts/import_dashboards -file /opt/dashboards.zip

  - name: Load the Packetbeat dashboard
    command: /usr/share/packetbeat/scripts/import_dashboards -file /opt/dashboards.zip

  - name: Add a default index pattern using Metricbeat
    command: >
      curl -XPUT http://localhost:9200/.kibana/config/{{ elastic_version }} -d '{"defaultIndex" : "metricbeat-*"}'

CHANGE the dashboad loading to a cleaner and downloadable base
CHANGE the dashboad loading to a cleaner and downloadable base
