blob: cd4e6aca9921b60425615a3d5f2afdae75761d6b (
plain)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
|
# Copyright 2020 Aditya Srivastava.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
#PAG setup in k8s cluster
#***********************************************************************************************************
#copy all yaml to /tmp/files/
#***********************************************************************************************************
- name: copy all yaml to /tmp/files/
copy:
src: ../files/
dest: /tmp/files/
#***********************************************************************************************************
#Creating Namespace
#***********************************************************************************************************
- name: Creating Monitoring Namespace
k8s:
state: present
src: /tmp/files/monitoring-namespace.yaml
namespace: monitoring
#***********************************************************************************************************
#creating Persistent Volume
#***********************************************************************************************************
- name: creating Persistent Volume for Prometheus
k8s:
state: present
src: /tmp/files/prometheus/prometheus-pv.yaml
namespace: monitoring
#***********************************************************************************************************
#creating Persistent Volume
#***********************************************************************************************************
- name: creating Persistent Volume for Grafana
k8s:
state: present
src: /tmp/files/grafana/grafana-pv.yaml
namespace: monitoring
#***********************************************************************************************************
#creating Persistent Volume Claim
#***********************************************************************************************************
- name: creating Persistent Volume Claim for Prometheus
k8s:
state: present
src: /tmp/files/prometheus/prometheus-pvc.yaml
namespace: monitoring
#***********************************************************************************************************
#creating Persistent Volume Claim
#***********************************************************************************************************
- name: creating Persistent Volume Claim for Grafana
k8s:
state: present
src: /tmp/files/grafana/grafana-pvc.yaml
namespace: monitoring
#***********************************************************************************************************
#Making the CAdvisor deamonset
#***********************************************************************************************************
- name: Creating cAdvisor deamonset
k8s:
state: present
src: /tmp/files/cadvisor/cadvisor-deamonset.yaml
namespace: monitoring
#***********************************************************************************************************
#Starting the CAdvisor service
#***********************************************************************************************************
- name: Starting cAdvisor service
k8s:
state: present
src: /tmp/files/cadvisor/cadvisor-service.yaml
namespace: monitoring
#***********************************************************************************************************
#Deploying and Starting the kube-system-metrics service
#***********************************************************************************************************
- name: Deploying kube-system-metrics
k8s:
state: present
src: /tmp/files/kube-state-metrics/kube-state-metrics-deployment.yaml
namespace: kube-system
- name: Starting kube-system-metrics service
k8s:
state: present
src: /tmp/files/kube-state-metrics/kube-state-metrics-service.yaml
namespace: kube-system
#***********************************************************************************************************
#Making the NodeExporter deamonset
#***********************************************************************************************************
- name: Creating NodeExporter deamonset
k8s:
state: present
src: /tmp/files/node-exporter/nodeexporter-daemonset.yaml
namespace: monitoring
#***********************************************************************************************************
#Starting the NodeExporter service
#***********************************************************************************************************
- name: Starting NodeExporter service
k8s:
state: present
src: /tmp/files/node-exporter/nodeexporter-service.yaml
namespace: monitoring
#***********************************************************************************************************
#Making the collectd-exporter deployment
#***********************************************************************************************************
- name: Creating collectd-exporter deamonset
k8s:
state: present
src: /tmp/files/collectd-exporter/collectd-exporter-deployment.yaml
namespace: monitoring
#***********************************************************************************************************
#Making the collectd-exporter service
#***********************************************************************************************************
- name: Creating collectd-exporter service
k8s:
state: present
src: /tmp/files/collectd-exporter/collectd-exporter-service.yaml
namespace: monitoring
#***********************************************************************************************************
#Webhook goes here
#***********************************************************************************************************
#***********************************************************************************************************
#Making the config file for Alertmanagers
#***********************************************************************************************************
- name: Creating config map for Alertmanagers
k8s:
state: present
src: /tmp/files/alertmanager/alertmanager-config.yaml
namespace: monitoring
# - name: Creating config map for Alertmanagers
# k8s:
# state: present
# src: /tmp/files/alertmanager1-config.yaml
# namespace: monitoring
#***********************************************************************************************************
#Making the 1st alertmanager deployment
#***********************************************************************************************************
- name: Creating 1st alertmanager deployment
k8s:
state: present
src: /tmp/files/alertmanager/alertmanager-deployment.yaml
namespace: monitoring
#***********************************************************************************************************
#Making the 1st alertmanager service
#***********************************************************************************************************
- name: Creating 1st alertmanager service
k8s:
state: present
src: /tmp/files/alertmanager/alertmanager-service.yaml
namespace: monitoring
#***********************************************************************************************************
#Making the 2nd alertmanager deployment
#***********************************************************************************************************
- name: Creating 2nd alertmanager deployment
k8s:
state: present
src: /tmp/files/alertmanager/alertmanager1-deployment.yaml
namespace: monitoring
#***********************************************************************************************************
#Making the 2nd alertmanager service
#***********************************************************************************************************
- name: Creating 2nd alertmanager service
k8s:
state: present
src: /tmp/files/alertmanager/alertmanager1-service.yaml
namespace: monitoring
#***********************************************************************************************************
#Making the config file for Prometheus
#***********************************************************************************************************
- name: Creating 1st Prometheus Config
k8s:
state: present
src: /tmp/files/prometheus/prometheus-config.yaml
namespace: monitoring
# - name: Creating 2nd Prometheus Config
# k8s:
# state: present
# src: /tmp/files/prometheus1-config.yaml
# namespace: monitoring
#***********************************************************************************************************
#Starting Prometheus
#***********************************************************************************************************
- name: Starting Prometheus 1
k8s:
state: present
src: /tmp/files/prometheus/prometheus-deployment.yaml
namespace: monitoring
- name: Starting Prometheus 2
k8s:
state: present
src: /tmp/files/prometheus/prometheus1-deployment.yaml
namespace: monitoring
#***********************************************************************************************************
#Starting Prometheus Service
#***********************************************************************************************************
- name: Starting Prometheus 1 Service
k8s:
state: present
src: /tmp/files/prometheus/prometheus-service.yaml
namespace: monitoring
- name: Starting Prometheus 2 Service
k8s:
state: present
src: /tmp/files/prometheus/prometheus1-service.yaml
namespace: monitoring
- name: Starting Main Prometheus Service
k8s:
state: present
src: /tmp/files/prometheus/main-prometheus-service.yaml
namespace: monitoring
#***********************************************************************************************************
#Starting Grafana
#***********************************************************************************************************
- name: Creating Grafana Datasource Config
k8s:
state: present
src: /tmp/files/grafana/grafana-datasource-config.yaml
namespace: monitoring
- name: Starting Grafana
k8s:
state: present
src: /tmp/files/grafana/grafana-deployment.yaml
namespace: monitoring
- name: Starting Grafana Service
k8s:
state: present
src: /tmp/files/grafana/grafana-service.yaml
namespace: monitoring
#***********************************************************************************************************
#removing /tmp/files
#***********************************************************************************************************
- name: Removing /tmp/files
file:
path: "/tmp/files"
state: absent
|