-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathmonit.yml
More file actions
51 lines (36 loc) · 1.25 KB
/
monit.yml
File metadata and controls
51 lines (36 loc) · 1.25 KB
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
---
- name: install monit
sudo: yes
apt: name=monit update_cache=yes
- name: allow localhost access in monit config
sudo: yes
lineinfile: dest=/etc/monit/monitrc line="{{ item }}"
with_items:
- "set httpd port 2812 and"
- "use address localhost"
- "allow localhost"
- when: enable_mail_alerts == True and smtp_use_tls == True
name: set tls_option
set_fact: smtp_tls_option="using tlsv1"
- when: enable_mail_alerts == True and smtp_use_tls != True
name: set tls_option
set_fact: smtp_tls_option=""
- when: enable_mail_alerts == True
name: set mail server for notifications in monit
lineinfile: dest=/etc/monit/monitrc line="{{ item }}"
with_items:
- "set mailserver {{ smtp_host }} port {{ smtp_port }} username {{ smtp_user }} password {{ smtp_password }} {{ smtp_tls_option }} with timeout 30 seconds"
- name: start monit & mark to be started on system reboots
service: name=monit state=started enabled=yes
- name: add monit config for elixir app
sudo: yes
template:
src: app.monit.j2
dest: "/etc/monit/conf.d/{{ app_name }}.monit"
- name: add monit config for nginx
sudo: yes
template:
src: nginx.monit.j2
dest: "/etc/monit/conf.d/nginx.monit"
- name: reload monit
service: name=monit state=reloaded