|
@@ -1,21 +1,42 @@
|
1
|
1
|
- name: Add monitoring vhost to apache
|
2
|
2
|
template: src=etc_apache2_sites-available_00-status.conf dest=/etc/apache2/sites-available/00-status.conf
|
|
3
|
+ notify: restart apache
|
|
4
|
+ when: default_http_redirect
|
3
|
5
|
|
4
|
6
|
- name: Enable the status vhost
|
5
|
7
|
command: a2ensite 00-status.conf creates=/etc/apache2/sites-enabled/00-status.conf
|
6
|
8
|
notify: restart apache
|
|
9
|
+ when: default_http_redirect
|
|
10
|
+
|
|
11
|
+- name: add buster-backport for Monit
|
|
12
|
+ apt_repository: repo='deb http://deb.debian.org/debian buster-backports main' state=present update_cache=yes
|
|
13
|
+ tags:
|
|
14
|
+ - dependencies
|
|
15
|
+ when: ansible_distribution_version == '10'
|
7
|
16
|
|
8
|
17
|
- name: Install monit
|
9
|
18
|
apt:
|
10
|
19
|
name: monit
|
11
|
20
|
state: present
|
|
21
|
+ default_release: buster-backports
|
12
|
22
|
tags:
|
13
|
23
|
- dependencies
|
|
24
|
+ when: ansible_distribution_version == '10'
|
|
25
|
+
|
|
26
|
+- name: Install monit
|
|
27
|
+ apt:
|
|
28
|
+ name: monit
|
|
29
|
+ state: present
|
|
30
|
+ tags:
|
|
31
|
+ - dependencies
|
|
32
|
+ when: ansible_distribution_version != '10'
|
14
|
33
|
|
15
|
34
|
- name: Copy monit master config file into place
|
16
|
35
|
template: src=etc_monit_monitrc.j2 dest=/etc/monit/monitrc
|
17
|
36
|
notify: restart monit
|
18
|
37
|
|
|
38
|
+# ---------------------------------------
|
|
39
|
+
|
19
|
40
|
- name: Determine if ZNC is installed
|
20
|
41
|
stat: path=/usr/lib/znc/configs/znc.conf
|
21
|
42
|
register: znc_config_file
|
|
@@ -76,6 +97,52 @@
|
76
|
97
|
stat: path=/etc/jitsi/jicofo/config
|
77
|
98
|
register: jitsi_config_file
|
78
|
99
|
|
|
100
|
+- name: Determine if MongoDB is installed
|
|
101
|
+ stat: path=/etc/mongod.conf
|
|
102
|
+ register: mongodb_config_file
|
|
103
|
+
|
|
104
|
+- name: Determine if Rocket.Chat is installed
|
|
105
|
+ stat: path=/usr/local/bin/Rocket.Chat/main.js
|
|
106
|
+ register: rocketchat_config_file
|
|
107
|
+
|
|
108
|
+- name: Determine if Apache2 is installed
|
|
109
|
+ stat: path=/etc/apache2/apache2.conf
|
|
110
|
+ register: apache2_config_file
|
|
111
|
+
|
|
112
|
+- name: Determine if Dovecot is installed
|
|
113
|
+ stat: path=/etc/dovecot/dovecot.conf
|
|
114
|
+ register: dovecot_config_file
|
|
115
|
+
|
|
116
|
+- name: Determine if Postfix is installed
|
|
117
|
+ stat: path=/etc/postfix/main.cf
|
|
118
|
+ register: postfix_config_file
|
|
119
|
+
|
|
120
|
+- name: Determine if sshd is installed
|
|
121
|
+ stat: path=/etc/ssh/sshd_config
|
|
122
|
+ register: sshd_config_file
|
|
123
|
+
|
|
124
|
+- name: Determine if pgsql_deb9 is installed
|
|
125
|
+ stat: path=/etc/postgresql/9.6/main/pg_ctl.conf
|
|
126
|
+ register: pgsql9_config_file
|
|
127
|
+
|
|
128
|
+- name: Determine if pgsql_deb10 is installed
|
|
129
|
+ stat: path=/etc/postgresql/11/main/pg_ctl.conf
|
|
130
|
+ register: pgsql10_config_file
|
|
131
|
+
|
|
132
|
+- name: Determine if pgsql_deb11 is installed
|
|
133
|
+ stat: path=/etc/postgresql/13/main/pg_ctl.conf
|
|
134
|
+ register: pgsql11_config_file
|
|
135
|
+
|
|
136
|
+- name: Determine if tomcat_deb9 is installed
|
|
137
|
+ stat: path=/etc/tomcat8/server.xml
|
|
138
|
+ register: tomcat9_config_file
|
|
139
|
+
|
|
140
|
+- name: Determine if tomcat_deb10 is installed
|
|
141
|
+ stat: path=/etc/tomcat9/server.xml
|
|
142
|
+ register: tomcat10_config_file
|
|
143
|
+
|
|
144
|
+# ---------------------------------------
|
|
145
|
+
|
79
|
146
|
- name: Copy ZNC monit service config files into place
|
80
|
147
|
copy: src=etc_monit_conf.d_znc dest=/etc/monit/conf.d/znc
|
81
|
148
|
notify: restart monit
|
|
@@ -156,38 +223,62 @@
|
156
|
223
|
notify: restart monit
|
157
|
224
|
when: openvpn_config_file.stat.exists == True
|
158
|
225
|
|
159
|
|
-- name: Copy monit service config files into place
|
160
|
|
- copy: src=etc_monit_conf.d_{{ item }} dest=/etc/monit/conf.d/{{ item }}
|
161
|
|
- with_items:
|
162
|
|
- - apache2
|
163
|
|
- - dovecot
|
164
|
|
- - postfix
|
165
|
|
- - sshd
|
|
226
|
+- name: Copy MongoDB monit service config files into place
|
|
227
|
+ copy: src=etc_monit_conf.d_mongodb dest=/etc/monit/conf.d/mongodb
|
166
|
228
|
notify: restart monit
|
|
229
|
+ when: mongodb_config_file.stat.exists == True
|
167
|
230
|
|
168
|
|
-- name: Copy monit service config files into place
|
169
|
|
- copy: src=etc_monit_conf.d_{{ item }} dest=/etc/monit/conf.d/{{ item }}
|
170
|
|
- with_items:
|
171
|
|
- - pgsql_deb9
|
172
|
|
- - tomcat_deb9
|
|
231
|
+- name: Copy Rocket.Chat monit service config files into place
|
|
232
|
+ copy: src=etc_monit_conf.d_rocketchat dest=/etc/monit/conf.d/rocketchat
|
173
|
233
|
notify: restart monit
|
174
|
|
- when: ansible_distribution_version == '9'
|
|
234
|
+ when: rocketchat_config_file.stat.exists == True
|
175
|
235
|
|
176
|
|
-- name: Copy monit service config files into place
|
177
|
|
- copy: src=etc_monit_conf.d_{{ item }} dest=/etc/monit/conf.d/{{ item }}
|
178
|
|
- with_items:
|
179
|
|
- - pgsql_deb10
|
180
|
|
- - tomcat_deb10
|
|
236
|
+- name: Copy apache2 monit service config files into place
|
|
237
|
+ copy: src=etc_monit_conf.d_apache2 dest=/etc/monit/conf.d/apache2
|
181
|
238
|
notify: restart monit
|
182
|
|
- when: ansible_distribution_version == '10'
|
|
239
|
+ when: apache2_config_file.stat.exists == True
|
183
|
240
|
|
184
|
|
-- name: Copy monit service config files into place
|
185
|
|
- copy: src=etc_monit_conf.d_{{ item }} dest=/etc/monit/conf.d/{{ item }}
|
186
|
|
- with_items:
|
187
|
|
- - pgsql_deb10
|
188
|
|
- - tomcat_deb10
|
|
241
|
+- name: Copy dovecot monit service config files into place
|
|
242
|
+ copy: src=etc_monit_conf.d_dovecot dest=/etc/monit/conf.d/dovecot
|
189
|
243
|
notify: restart monit
|
190
|
|
- when: ansible_distribution_version == '11'
|
|
244
|
+ when: dovecot_config_file.stat.exists == True
|
|
245
|
+
|
|
246
|
+- name: Copy postfix monit service config files into place
|
|
247
|
+ copy: src=etc_monit_conf.d_postfix dest=/etc/monit/conf.d/postfix
|
|
248
|
+ notify: restart monit
|
|
249
|
+ when: postfix_config_file.stat.exists == True
|
|
250
|
+
|
|
251
|
+- name: Copy sshd monit service config files into place
|
|
252
|
+ copy: src=etc_monit_conf.d_sshd dest=/etc/monit/conf.d/ssh
|
|
253
|
+ notify: restart monit
|
|
254
|
+ when: sshd_config_file.stat.exists == True
|
|
255
|
+
|
|
256
|
+- name: Copy pgsql deb9 monit service config files into place
|
|
257
|
+ copy: src=etc_monit_conf.d_pgsql_deb9 dest=/etc/monit/conf.d/pgsql_deb9
|
|
258
|
+ notify: restart monit
|
|
259
|
+ when: pgsql9_config_file.stat.exists == True
|
|
260
|
+
|
|
261
|
+- name: Copy tomcat deb9 monit service config files into place
|
|
262
|
+ copy: src=etc_monit_conf.d_tomcat_deb9 dest=/etc/monit/conf.d/tomcat_deb9
|
|
263
|
+ notify: restart monit
|
|
264
|
+ when: tomcat9_config_file.stat.exists == True
|
|
265
|
+
|
|
266
|
+- name: Copy pgsql deb10 monit service config files into place
|
|
267
|
+ copy: src=etc_monit_conf.d_pgsql_deb10 dest=/etc/monit/conf.d/pgsql_deb10
|
|
268
|
+ notify: restart monit
|
|
269
|
+ when: pgsql10_config_file.stat.exists == True
|
|
270
|
+
|
|
271
|
+- name: Copy tomcat deb10 monit service config files into place
|
|
272
|
+ copy: src=etc_monit_conf.d_tomcat_deb10 dest=/etc/monit/conf.d/tomcat_deb10
|
|
273
|
+ notify: restart monit
|
|
274
|
+ when: tomcat10_config_file.stat.exists == True
|
|
275
|
+
|
|
276
|
+- name: Copy pgsql deb11 monit service config files into place
|
|
277
|
+ copy: src=etc_monit_conf.d_pgsql_deb11 dest=/etc/monit/conf.d/pgsql_deb11
|
|
278
|
+ notify: restart monit
|
|
279
|
+ when: pgsql11_config_file.stat.exists == True
|
|
280
|
+
|
|
281
|
+# ---------------------------------------
|
191
|
282
|
|
192
|
283
|
# TODO add to fail2ban when monit_page_public == 1
|
193
|
284
|
|