Skip to content

Latest commit

 

History

History
226 lines (176 loc) · 7.44 KB

README.md

File metadata and controls

226 lines (176 loc) · 7.44 KB

Github (tag) Github (license) Github (issues) Github (pull requests)

Travis (com)

Ansible (min. version) Ansible (platforms) Ansible (tags)

Ansible Role: srv_monit

An Ansible Role to install and configure monit.

Motivation

Monit is a simple, yet powerful monitoring software. It is easy to configure and most servers some kind of monitoring.

Description

This role installs and configures monit.

  • install the packages
  • configure mail server
  • configure alerts
  • configure web access
  • configure basic checks
  • configure the firewall

You will be able to put your additional checks in '/etc/monit.d/'.

Requirements

Dependency Roles:

For CentOS and RHEL Systems, the EPEL repository must be enabled. You can achieve this by using the while_true_do.rpo_epel Ansible Role.

Used Modules:

Installation

Install from Ansible Galaxy

ansible-galaxy install while_true_do.srv_monit

Install from Github

git clone https://github.com/while-true-do/ansible-role-srv_monit.git while_true_do.srv_monit

Dependencies:

ansible-galaxy install -r requirements.yml

Usage

Role Variables

---
# defaults file for while_true_do.srv_monit

## Package Management
wtd_srv_monit_package: "monit"
# State can be present|latest|absent
wtd_srv_monit_package_state: "present"

## Configuration Management
wtd_srv_monit_conf: []
# daemon: 30
# start_delay: 30
# log: "syslog"
# pidfile: "/var/run/monit.pid"
# idfile: "/var/monit/monit.id"
# statefile: "/var/monit/monit.state"
# eventqueue:
#   basedir: "/var/monit/events/"
#   slots: "1000"
# mmonit: ""

wtd_srv_monit_conf_alert: []
# recipients:
#   - "mail-address [with reminder on number <cycles>] [{ filter }]"
# mailserver:
#   host: "<hostname>|<ip-address>"
#   port: "25"

wtd_srv_monit_conf_web:
  enabled: true
# port: "2812"
# address: "127.0.0.1"
# signature: "disable"
# ssl: false
# pemfile: "<path to pemfile>"
# pam: true
# allows: ""
#   - "<username>:<password> [read-only]"
#   - "<fqdn>"
#   - "<ip-address>"
#   - "<ip-range>"
#   - "<@unix-group>"

# Enable checks for system resources
wtd_srv_monit_conf_check_system:
  enabled: true
wtd_srv_monit_conf_check_mounts:
  enabled: true
  mounts:
    - name: "rootfs"
      mount: "/"

## Service Management
wtd_srv_monit_service: "monit"
# State can be started|stopped
wtd_srv_monit_service_state: "started"
wtd_srv_monit_service_enabled: true

## Firewalld Management
wtd_srv_monit_fw_mgmt: true
wtd_srv_monit_fw_port: "{{ wtd_srv_monit_conf_web.port | default('2812') }}/tcp"
# State can be enabled|disabled
wtd_srv_monit_fw_state: "enabled"
# Zone can be according to defined zones on your machine.
wtd_srv_monit_fw_zone: "public"

Example Playbook

Running Ansible Roles can be done in a playbook.

Simple

---
- hosts: all
  roles:
    - role: while_true_do.rpo_epel
    - role: while_true_do.srv_monit

Advanced

Configure the webserver to listen on all addresses, add an admin user and allow the wheel-group (sudoers) to access with read only permission.

- hosts: all
  roles:
    - role: while_true_do.rpo_epel
    - role: while_true_do.srv_monit
      wtd_srv_monit_conf_web:
        enabled: true
        address: "0.0.0.0"
        allows:
          - "admin:admin"
          - "@wheel read-only"

Known Issues

  1. RedHat Testing is currently not possible in public, due to limitations in subscriptions.
  2. Some services and features cannot be tested properly, due to limitations in docker.

Testing

Most of the "generic" tests are located in the Test Library.

Ansible specific testing is done with Molecule.

Infrastructure testing is done with testinfra.

Automated testing is done with Travis CI.

Contribute

Thank you so much for considering to contribute. We are very happy, when somebody is joining the hard work. Please fell free to open Bugs, Feature Requests or Pull Requests after reading the Contribution Guideline.

See who has contributed already in the kudos.txt.

License

This work is licensed under a BSD-3-Clause License.

Contact