---
 - name: Sharingan packages
   become: yes
   register: sharingan_packages
   package:
     name:
       - elasticsearch
       - mongodb
       - graylog
     state: present

 - name: Sharingan services
   become: yes
   loop:
       - elasticsearch
       - mongodb
       - graylog
   service:
     name: "{{ item }}" 
     state: started
     enabled: yes

 - name: Sharingan backups directory
   become: yes
   file:
     path: /usr/local/backups/elasticsearch
     state: directory
     owner: elasticsearch
     group: elasticsearch
     mode: 0770

 - name: Set Sharingan backups
   command: "curl -X PUT localhost:9200/_snapshot/my_backup?pretty -H 'Content-Type: application/json' -d '{ type: fs, settings: { location: /usr/local/backup/elasticsearch, compress: true } }'"
