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

145 lines
2.9 KiB
YAML
Raw Normal View History

2020-10-08 16:33:19 -05:00
---
2020-10-18 23:49:25 -05:00
- name: Sharingan data filers
become: yes
package:
state: present
name:
- syslog-ng
2022-01-25 23:54:43 -06:00
- monit
- monitoring-plugins
2020-10-18 23:49:25 -05:00
- name: Sharingan-Data apps dir
become: yes
file:
path: /etc/syslog-ng/apps.d
state: directory
- name: Sharingan-Data include apps dir
become: yes
2022-01-25 23:54:43 -06:00
register: base_config
2020-10-18 23:49:25 -05:00
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
2022-01-25 23:54:43 -06:00
- 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
2020-10-18 23:49:25 -05:00
- name: Sharingan-Data filer service
become: yes
copy:
2022-01-25 23:54:43 -06:00
src: "sharingan-data.service/{{ ansible_os_family }}"
2020-10-18 23:49:25 -05:00
dest: /usr/lib/systemd/system/sharingan-data.service
owner: root
group: root
mode: 0750
2022-01-25 23:54:43 -06:00
- 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
2020-10-18 23:49:25 -05:00
become: yes
2022-01-25 23:54:43 -06:00
copy:
src: templates
dest: /etc/monit.d/templates
owner: root
group: root
mode: 0700
2020-10-18 23:49:25 -05:00
2022-01-25 23:54:43 -06:00
- name: Sharingan-Eval monit scripts
2020-10-18 23:49:25 -05:00
become: yes
2022-01-25 23:54:43 -06:00
copy:
src: templates
dest: /etc/monit.d/scripts
owner: root
group: root
mode: 0700
2020-10-18 23:49:25 -05:00
2022-01-25 23:54:43 -06:00
- name: Sharingan-Eval monit host config
become: yes
copy:
src: "{{ inventory_hostname }}"
dest: "/etc/monit.d/{{ inventory_hostname }}"
owner: root
group: root
mode: 0700
2020-10-18 23:49:25 -05:00
- 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 }}"
2022-01-25 23:54:43 -06:00
state: restarted
2020-10-18 23:49:25 -05:00
enabled: yes
loop:
- sharingan-data.service
2022-01-25 23:54:43 -06:00
- sharingan-heartbeat.timer
- sharingan-eval.service
2020-10-18 23:49:25 -05:00
- name: Disable default service
become: yes
2022-01-25 23:54:43 -06:00
ignore_errors: yes
2020-10-18 23:49:25 -05:00
service:
name: syslog-ng@default.service
state: stopped
enabled: no