Move services of mailserver's monitoring to a dedicated role
This commit is contained in:
parent
8ba59814bb
commit
6f78bac499
6 changed files with 63 additions and 21 deletions
|
@ -26,5 +26,7 @@
|
|||
tags: spf, report
|
||||
- role: mailserver_dmarc
|
||||
tags: dmarc, report
|
||||
- role: mailserver_monitoring
|
||||
tags: monitoring, icinga, icinga2
|
||||
- role: mailserver_dns_report
|
||||
tags: report
|
||||
|
|
|
@ -52,7 +52,26 @@
|
|||
group: nagios
|
||||
mode: 0644
|
||||
with_fileglob:
|
||||
- "{{ role_path }}/templates/zones.d/master/*"
|
||||
- "{{ role_path }}/templates/zones.d/master/*.conf.j2"
|
||||
notify: Reload icinga2 service
|
||||
|
||||
- name: Create services directory
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: /etc/icinga2/zones.d/master/services
|
||||
state: directory
|
||||
owner: nagios
|
||||
group: nagios
|
||||
mode: 0750
|
||||
|
||||
- name: Copy common services
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: zones.d/master/services/common.conf.j2
|
||||
dest: /etc/icinga2/zones.d/master/services/common.conf
|
||||
owner: nagios
|
||||
group: nagios
|
||||
mode: 0644
|
||||
notify: Reload icinga2 service
|
||||
|
||||
- name: Install bsd-mailx for sending mail notifications
|
||||
|
|
|
@ -87,23 +87,3 @@ apply Service "mailq" {
|
|||
vars.mailq_warning = 10
|
||||
vars.mailq_critical = 20
|
||||
}
|
||||
|
||||
apply Service "smtp" {
|
||||
import "generic-service"
|
||||
check_command = "smtp"
|
||||
assign where host.name == "{{ relayhost }}"
|
||||
}
|
||||
|
||||
apply Service "submission" {
|
||||
import "generic-service"
|
||||
check_command = "smtp"
|
||||
assign where host.name == "{{ relayhost }}"
|
||||
vars.smtp_port = 587
|
||||
vars.smtp_starttls = true
|
||||
}
|
||||
|
||||
apply Service "imaps" {
|
||||
import "generic-service"
|
||||
check_command = "simap"
|
||||
assign where host.name == "{{ relayhost }}"
|
||||
}
|
8
roles/mailserver_monitoring/handlers/main.yml
Normal file
8
roles/mailserver_monitoring/handlers/main.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
|
||||
- name: Reload icinga2 service
|
||||
delegate_to: "{{ icinga2_master }}"
|
||||
become: true
|
||||
ansible.builtin.systemd:
|
||||
name: icinga2
|
||||
state: reloaded
|
12
roles/mailserver_monitoring/tasks/main.yml
Normal file
12
roles/mailserver_monitoring/tasks/main.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
|
||||
- name: Copy mailserver services on icinga2 Master
|
||||
delegate_to: "{{ icinga2_master }}"
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: zones.d/master/services/mailserver.conf.j2
|
||||
dest: /etc/icinga2/zones.d/master/services/mailserver.conf
|
||||
owner: nagios
|
||||
group: nagios
|
||||
mode: 0644
|
||||
notify: Reload icinga2 service
|
|
@ -0,0 +1,21 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
apply Service "smtp" {
|
||||
import "generic-service"
|
||||
check_command = "smtp"
|
||||
assign where host.name == "{{ inventory_hostname }}"
|
||||
}
|
||||
|
||||
apply Service "submission" {
|
||||
import "generic-service"
|
||||
check_command = "smtp"
|
||||
assign where host.name == "{{ inventory_hostname }}"
|
||||
vars.smtp_port = 587
|
||||
vars.smtp_starttls = true
|
||||
}
|
||||
|
||||
apply Service "imaps" {
|
||||
import "generic-service"
|
||||
check_command = "simap"
|
||||
assign where host.name == "{{ inventory_hostname }}"
|
||||
}
|
Loading…
Reference in a new issue