2020-08-04 23:57:58 +00:00
|
|
|
---
|
|
|
|
- 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:
|
2020-08-05 00:01:42 +00:00
|
|
|
- name: Setup monitrc
|
|
|
|
template:
|
|
|
|
src: monitrc
|
|
|
|
dest: "/etc/monit/monitrc"
|
|
|
|
owner: root
|
|
|
|
group: root
|
2020-08-05 00:43:46 +00:00
|
|
|
mode: 0600
|
2020-08-05 00:11:17 +00:00
|
|
|
notify:
|
2020-08-05 00:15:47 +00:00
|
|
|
- restart monit
|
2020-08-05 00:01:42 +00:00
|
|
|
tags:
|
|
|
|
- monit-config
|
2020-08-04 23:57:58 +00:00
|
|
|
- name: Setup filesystem monitoring
|
|
|
|
template:
|
|
|
|
src: filesystem
|
|
|
|
dest: "/etc/monit/conf.d/{{item.name}}"
|
|
|
|
owner: root
|
|
|
|
group: root
|
2020-08-05 00:43:46 +00:00
|
|
|
mode: 0600
|
2020-08-04 23:57:58 +00:00
|
|
|
loop:
|
2020-08-05 00:00:36 +00:00
|
|
|
"{{ monit_filesystems }}"
|
2020-08-05 00:11:17 +00:00
|
|
|
notify:
|
2020-08-05 00:15:47 +00:00
|
|
|
- restart monit
|
2020-08-04 23:57:58 +00:00
|
|
|
tags:
|
|
|
|
- monit-config
|
2020-08-05 00:04:22 +00:00
|
|
|
- monit-filesystems
|
2020-08-05 00:58:13 +00:00
|
|
|
- name: Setup wireguard monitoring
|
|
|
|
template:
|
|
|
|
src: wireguard
|
|
|
|
dest: "/etc/monit/conf.d/wireguard"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0600
|
2020-08-05 01:02:57 +00:00
|
|
|
when: monit_wireguard
|
2020-08-05 00:58:13 +00:00
|
|
|
notify:
|
|
|
|
- restart monit
|
|
|
|
tags:
|
|
|
|
- monit-config
|
|
|
|
- monit-wireguard
|
2020-08-05 00:04:22 +00:00
|
|
|
- name: Setup slideshow monitoring
|
|
|
|
template:
|
|
|
|
src: fim
|
|
|
|
dest: "/etc/monit/conf.d/fim"
|
|
|
|
owner: root
|
|
|
|
group: root
|
2020-08-05 00:43:46 +00:00
|
|
|
mode: 0600
|
2020-08-05 00:11:17 +00:00
|
|
|
notify:
|
2020-08-05 00:15:47 +00:00
|
|
|
- restart monit
|
2020-08-05 00:04:22 +00:00
|
|
|
tags:
|
|
|
|
- monit-config
|
|
|
|
- monit-fim
|
2020-08-05 00:08:07 +00:00
|
|
|
- name: Setup firewall rule
|
|
|
|
firewalld:
|
|
|
|
port: 2812/tcp
|
|
|
|
zone: public
|
|
|
|
permanent: yes
|
|
|
|
state: enabled
|
|
|
|
immediate: yes
|
2020-08-05 00:11:17 +00:00
|
|
|
tags:
|
|
|
|
- monit-config
|