-
Notifications
You must be signed in to change notification settings - Fork 72
/
vagrant.yml
91 lines (87 loc) · 2.76 KB
/
vagrant.yml
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
---
- hosts: all
sudo: yes
vars:
monit_cycle: 120
monit_log_destination: syslog
monit_eventqueue_dir: /var/lib/monit/events
monit_services:
- name: sshd
type: process
target: /var/run/sshd.pid
start: /usr/sbin/service sshd start
stop: /usr/sbin/service sshd stop
- name: apache
type: process
target: /var/run/apache2.pid
start: /usr/sbin/service apache2 start
stop: /usr/sbin/service apache2 stop
restart: /usr/sbin/service apache2 restart
rules:
- "if failed port 80 protocol http then restart"
- "if 5 restarts within 5 cycles then timeout"
- name: my_file
type: file
target: /etc/monit/monitrc
rules:
- "if changed timestamp then exec \"/bin/bash -c 'echo `data` >> /tmp/foo.bar.changed'\""
- name: my_filesystem
type: filesystem
target: /dev/sda1
rules:
- "if space usage > 80% for 5 times within 15 cycles then alert"
- name: my_directory
type: directory
target: /etc/monit
rules:
- "if timestamp < 1 hour then alert"
- name: google
type: host
target: google.com
rules:
- "if failed port 443 type tcpSSL protocol http then alert"
- name: localhost
type: system
rules:
- "if loadavg (1min) > 2 then alert"
- "if loadavg (5min) > 2 then alert"
- "if memory usage > 75% then alert"
- "if cpu usage (user) > 70% for 8 cycles then alert"
- "if cpu usage (system) > 40% for 8 cycles then alert"
- "if cpu usage (wait) > 20% for 8 cycles then alert"
monit_webinterface_enabled: true
monit_webinterface_acl_rules:
- "0.0.0.0/0"
monit_webinterface_bind: 0.0.0.0
monit_mail_enabled: true
monit_mailserver_host: localhost
monit_mailserver_port: 25
monit_mailserver_user: root
monit_mailserver_password: root
monit_alert_addresses:
monit_alert_mail_from: vagrant@localhost
monit_alert_mail_subject: alert
monit_alert_mail_message: |+
$EVENT Service $SERVICE
Date: $DATE
Action: $ACTION
Host: $HOST
Description: $DESCRIPTION
Your faithful employee,
Monit
pre_tasks:
- name: testing - install apache - debian
apt:
pkg: apache2
update_cache: yes
cache_valid_time: 3600
state: installed
when: ansible_os_family == "Debian"
- name: testing - install apache - redhat
yum:
pkg: httpd
state: installed
when: ansible_os_family == "RedHat"
roles:
- role: '{{playbook_dir}}'