From bbb06c3a5971c87cc8957fe28caa075df1a2be70 Mon Sep 17 00:00:00 2001 From: Daniel Pietersen Date: Sat, 10 Jul 2021 17:02:37 +0200 Subject: [PATCH 1/3] Support ignored actions --- README.md | 1 + defaults/main.yml | 1 + templates/mail.j2 | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b57e920..8c4442d 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ Role Variables * `monit_mailserver_timeout`: Timeout for mailserver connection. Defaults to `5`. * `monit_mailserver_ssl_version`: If defined, monit will use this algorithm for SSL connection to the mail server. Possible values are `SSLAUTO`, `SSLV2`, `SSLV3`, `TLSV1`, `TLSV11`, `TLSV12`. * `monit_alert_addresses`: List of mail addresses where the alerts will be sent to. +* `monit_ignored_actions`: List of actions that shouldn't trigger an email. Optional. * `monit_alert_mail_format`: A hash of options for mail-format. * `from`: Sender mail address. * `reply-to`: A reply-to mail address. diff --git a/defaults/main.yml b/defaults/main.yml index d2c14c5..ac97d06 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -10,6 +10,7 @@ monit_service_delete_unlisted: true monit_mail_enabled: false monit_mailserver_host: localhost monit_mailserver_port: 25 +monit_ignored_actions: "instance, action" monit_webinterface_enabled: true monit_webinterface_bind: 0.0.0.0 diff --git a/templates/mail.j2 b/templates/mail.j2 index 130acd9..0a0c102 100644 --- a/templates/mail.j2 +++ b/templates/mail.j2 @@ -10,7 +10,7 @@ set mailserver {{ monit_mailserver_host }} port {{ monit_mailserver_port }} with timeout {{ monit_mailserver_timeout | default(5) }} seconds {% for address in monit_alert_addresses %} -set alert {{ address }} +set alert {{ address }} not on { {{ monit_ignored_actions }} } {% endfor -%} {% if monit_alert_mail_format is defined -%} From 904444c62e29e53feb02fdcddaa7d4628ff10128 Mon Sep 17 00:00:00 2001 From: Daniel Pietersen Date: Sat, 10 Jul 2021 17:09:54 +0200 Subject: [PATCH 2/3] Update README --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8c4442d..7eed4e8 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ Monit ======== -Ansible role for configuring Monit. Sample usage see [example.yml](http://github.com/pgolm/ansible-playbook-monit/blob/master/example.yml). +Ansible role for configuring Monit. Sample usage see [example.yml](https://github.com/Skowt/ansible-role-monit/blob/master/example.yml). Install ------- -Install this role with [ansible-galaxy](https://galaxy.ansible.com/pgolm/monit/). +Install this role with [ansible-galaxy](https://galaxy.ansible.com/skowt/ansible_role_monit). ```shell -$ ansible-galaxy install pgolm.monit +$ ansible-galaxy install skowt.ansible_role_monit ``` Requirements @@ -72,6 +72,7 @@ Feel free to contribute by add issue and pull request. CONTRIBUTORS ------------ +* [Skowt](https://github.com/Skowt) * [Amnay](https://github.com/amnay-mo) * [Anthony Dmitriyev](https://github.com/antstorm) * [byteshiva](http://byteshiva.github.io/) From c76f82a4fcafce335fc24cf9864bfa42f00f0e7f Mon Sep 17 00:00:00 2001 From: Daniel Pietersen Date: Sat, 10 Jul 2021 17:35:50 +0200 Subject: [PATCH 3/3] Linting --- tasks/mail.yml | 2 +- tasks/service.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tasks/mail.yml b/tasks/mail.yml index bdba9a6..b42de4e 100644 --- a/tasks/mail.yml +++ b/tasks/mail.yml @@ -2,7 +2,7 @@ - name: mail - Setup mail alerts template: src: mail.j2 - dest: {{ monit_includes }}/mail + dest: "{{ monit_includes }}/mail" owner: root group: root mode: 0644 diff --git a/tasks/service.yml b/tasks/service.yml index 7e4a27a..38d14ce 100644 --- a/tasks/service.yml +++ b/tasks/service.yml @@ -4,4 +4,3 @@ name: "{{ monit_service }}" state: started enabled: yes -