-- name: Install logcheck
+- name: Install logcheck (Debian)
become: true
apt:
autoclean: yes
update_cache: yes
when: ansible_facts.os_family == 'Debian'
-- name: Install logcheck
+- name: Install logcheck (RedHat)
become: true
dnf:
name: logcheck
update_cache: yes
when: ansible_facts.os_family == 'RedHat'
-- name: Configure logcheck
+- name: Configure logcheck - intro
become: true
lineinfile:
path: /etc/logcheck/logcheck.conf
line: "INTRO=0"
insertafter: "^#INTRO=1$"
-- name: Update logcheck ignore patterns
+- name: Configure logcheck - send email to root
+ become: true
+ lineinfile:
+ path: /etc/logcheck/logcheck.conf
+ regexp: '^SENDMAILTO="root"$'
+ line: 'SENDMAILTO="root"'
+ insertafter: '^SENDMAILTO="logcheck"$'
+
+- name: Configure logcheck - do not send email to logcheck
+ become: true
+ lineinfile:
+ path: /etc/logcheck/logcheck.conf
+ regexp: '^SENDMAILTO="logcheck"$'
+ state: absent
+
+- name: Update logcheck ignore files
become: true
copy:
src: ignore.d/