-
Notifications
You must be signed in to change notification settings - Fork 0
/
monitoring.yaml
91 lines (85 loc) · 1.77 KB
/
monitoring.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
#Written by karakara104
- name: bootstrap monitoring server
hosts: monitoring
become: True
vars:
loki_server: "{{ hostvars['monitoring'].ansible_host }}"
roles:
- prometheus
- loki
- prometheus_node_exporter
- promtail
- grafana
tags:
- install-monitoring-stack
- name: copy files
hosts: monitoring
become: True
tasks:
- name: send files to vm
ansible.builtin.copy:
src: "../res/sysfiles/00-promtail-relay.conf"
dest: /etc/rsyslog.d/
owner: root
group: root
mode: '0644'
tags:
- copy-sysfiles
- hosts: vm_linux
become: yes
vars:
loki_server: "{{ hostvars['monitoring'].ansible_host }}"
roles:
- prometheus_node_exporter # install prometheus node exporter
- promtail
tags:
- install-prometheus-agents-promtail
- name: reload loki service
hosts: monitoring
become: True
tasks:
- name: restart loki
service:
name: loki
enabled: true
state: restarted
become: true
tags:
- post-install-server
- name: reload promtail service
hosts: vm_linux
become: True
tasks:
- name: restart promtail
service:
name: promtail
enabled: true
state: restarted
become: true
tags:
- post-install-agent
- name: reload rsyslog service
hosts: monitoring
become: True
tasks:
- name: restart rsyslog
service:
name: rsyslog
enabled: true
state: restarted
become: true
tags:
- post-install-server
- name: reload prometheus service
hosts: monitoring
become: True
tasks:
- name: restart prometheus
service:
name: prometheus
enabled: true
state: restarted
become: true
tags:
- post-install-server