---
# file: roles/elastalert/handlers/main.yml

- name: "Add ElastAlert to Boot-List"
  systemd:
    name='elastalert'
    state='started'
    daemon_reload=yes
    enabled=yes

- name: "ElastAlert installation"
  shell: '{{ item }}'
  args:
    chdir: '/opt/elastalert'
  with_items:
    - 'python setup.py install'
    - '/usr/local/bin/elastalert-create-index --host "localhost" --port "9200" --no-auth --index "elastalert_status" --old-index ""'
