Kapisi/roles/Sharingan-Data/tasks/main.yml

145 lines
2.9 KiB
YAML

---
- name: Sharingan data filers
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@sharingan-data
dest: /etc/default/syslog-ng@sharingan-data
owner: root
group: root
mode: 0655
- name: Sharingan-Data filer service
become: yes
copy:
src: "sharingan-data.service/{{ ansible_os_family }}"
dest: /usr/lib/systemd/system/sharingan-data.service
owner: root
group: root
mode: 0750
- name: Sharingan-Eval service
become: yes
copy:
src: sharingan-eval.service
dest: /usr/lib/systemd/system/sharingan-eval.service
owner: root
group: root
mode: 0750
- name: Sharingan-Eval monitrc
become: yes
template:
src: monitrc.j2
dest: /etc/monitrc
owner: root
group: root
mode: 0700
- name: Sharingan-Eval includes dir
become: yes
file:
path: /etc/monit.d
state: directory
- name: Sharingan-Eval monit templates
become: yes
copy:
src: templates
dest: /etc/monit.d/templates
owner: root
group: root
mode: 0700
- name: Sharingan-Eval monit scripts
become: yes
copy:
src: templates
dest: /etc/monit.d/scripts
owner: root
group: root
mode: 0700
- name: Sharingan-Eval monit host config
become: yes
copy:
src: "{{ inventory_hostname }}"
dest: "/etc/monit.d/{{ inventory_hostname }}"
owner: root
group: root
mode: 0700
- name: Sharingan-Data heartbeat service
become: yes
copy:
src: sharingan-heartbeat.service
dest: /usr/lib/systemd/system
owner: root
group: root
mode: 0750
- 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
- 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