Initial bring up of monit role
This commit is contained in:
parent
12bbc819f8
commit
1985761f00
|
@ -4,3 +4,4 @@
|
|||
roles:
|
||||
- msmtp
|
||||
- hdmi
|
||||
- monit
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
|
||||
# Notifiation email setup
|
||||
monit_notification_email: "user@domain.tld"
|
||||
monit_smtp_server: "mail.domain.tld"
|
||||
monit_smtp_user: "user@domain.tld"
|
||||
monit_smtp_password: "password"
|
||||
|
||||
# Filesystems to monitor
|
||||
monit_filesystems:
|
||||
- { name: "rootfs", path: "/", alert: "80%" }
|
||||
|
||||
# Monitor WireGuard?
|
||||
monit_wireguard: true
|
||||
|
||||
# Username / password for monit web service
|
||||
monit_web_user: "admin"
|
||||
monit_web_pasword: "password"
|
0
roles/monit/handlers/main.yml
Normal file
0
roles/monit/handlers/main.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
- name: Gather instance facts
|
||||
setup:
|
||||
- name: Update APT package cache
|
||||
apt:
|
||||
update_cache: "true"
|
||||
cache_valid_time: "3600"
|
||||
tags:
|
||||
- monit-install
|
||||
- name: Install monit
|
||||
package:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
vars:
|
||||
packages:
|
||||
- monit
|
||||
tags:
|
||||
- monit-install
|
||||
- block:
|
||||
- name: Setup filesystem monitoring
|
||||
template:
|
||||
src: filesystem
|
||||
dest: "/etc/monit/conf.d/{{item.name}}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
loop:
|
||||
{{ monit_filesystems }}
|
||||
tags:
|
||||
- monit-config
|
||||
- monit-filesystems
|
2
roles/monit/templates/filesystem
Normal file
2
roles/monit/templates/filesystem
Normal file
|
@ -0,0 +1,2 @@
|
|||
check filesystem {{ item.name }} with path {{ item.path }}
|
||||
if space usage > {{ item.alert }} then alert
|
15
roles/monit/templates/monitrc
Normal file
15
roles/monit/templates/monitrc
Normal file
|
@ -0,0 +1,15 @@
|
|||
set log /var/log/monit.log
|
||||
set idfile /var/lib/monit/id
|
||||
set statefile /var/lib/monit/state
|
||||
set eventqueue
|
||||
|
||||
set mailserver {{ monit_smtp_server }} port 587
|
||||
username "{{ monit_smtp_user }}" password "{{ monit_smtp_password }}"
|
||||
using tls
|
||||
|
||||
set httpd port 2812 and
|
||||
use address 0.0.0.0
|
||||
allow {{ monit_web_user }}:{{ monit_web_pasword }}
|
||||
|
||||
include /etc/monit/conf.d/*
|
||||
include /etc/monit/conf-enabled/*
|
Loading…
Reference in a new issue