---

 - name: Sharingan-Heartbeat service
   become: yes
   register: heartbeat_service
   copy:
     src: "{{ item }}"
     dest: /usr/lib/systemd/system
     owner: root
     group: root
     mode: 0750
   loop:
     - sharingan-heartbeat.timer
     - sharingan-heartbeat.service

 - name: Sharingan-Data heartbeat timer
   become: yes
   copy:
     src: sharingan-heartbeat.timer
     dest: /usr/lib/systemd/system
     owner: root
     group: root
     mode: 0750

 - systemd:
     daemon_reload: yes
   become: yes
   when: data_service.changed or eval_service.changed or heartbeat_service.changed

 - name: Start Sharingan-Data services
   become: yes
   service:
     name: "{{ item }}"
     state: restarted
     enabled: yes
   loop:
     - sharingan-data.service
     - sharingan-heartbeat.timer
     - sharingan-eval.service

 - name: Disable default service
   become: yes
   ignore_errors: yes
   service:
     name: syslog-ng@default.service
     state: stopped
     enabled: no

