ansible-role-postfix/tasks/logging.yml
2023-11-03 22:18:02 +01:00

25 lines
891 B
YAML

---
- name: "Logging | Install rsyslog"
ansible.builtin.apt:
pkg: rsyslog
- name: "Logging | Disable logging of IP addresses"
ansible.builtin.copy:
src: rsyslog.d/mail.conf
dest: /etc/rsyslog.d/mail.conf
mode: "0644"
notify: restart rsyslog
- name: "Logging | Disable mail logging to syslog"
ansible.builtin.replace:
path: /etc/rsyslog.conf
regexp: "^\\*\\.\\*(?!.*(mail\\.none).*$).*"
replace: "*.*;auth,authpriv.none,mail.none -/var/log/syslog"
notify: restart rsyslog
- name: "Logging | Setup cron job for pflogsum"
ansible.builtin.cron:
name: "Daily pflogsum statistics"
job: '/usr/sbin/pflogsumm {{ pflogsumm_options }} {{ pflogsumm_file }} | mail -s "{{ postfix_pflogsumm_mail_subject }} ({{ inventory_hostname }})" {{ postfix_pflogsumm_recipient }}'
hour: "{{ pflogsumm_cron_hour }}"
minute: "{{ pflogsumm_cron_minute }}"