---

 - name: Sharingan data packages
   become: yes
   package:
     state: present
     name:
       - syslog-ng
       - monit
       - monitoring-plugins

 - name: Sharingan-Data apps dir
   become: yes
   file:
     path: /etc/syslog-ng/apps.d
     state: directory

 - name: Sharingan-Data include apps dir
   become: yes
   register: base_config
   lineinfile:
     path: /etc/syslog-ng/syslog-ng.conf
     line: "{{ item }}"
   loop:
     - '# Allow compartmentalization of config'
     - '@include "apps.d/*.conf"'

 - name: Sharingan-Data conf
   become: yes
   template:
     src: graylog.conf.j2
     dest: /etc/syslog-ng/apps.d/graylog.conf
     owner: root
     group: root
     mode: 0750

 - name: Sharingan-Data service conf
   become: yes
   copy:
     src: syslog-ng/syslog-ng@sharingan-data
     dest: /etc/default/syslog-ng@sharingan-data
     owner: root
     group: root
     mode: 0655

 - name: Sharingan-Data filer service
   become: yes
   register: data_service
   copy:
     src: "syslog-ng/sharingan-data.service/{{ ansible_os_family }}"
     dest: /usr/lib/systemd/system/sharingan-data.service
     owner: root
     group: root
     mode: 0750
