2022-12-20 19:47:11 +01:00
|
|
|
---
|
|
|
|
- name: "install logcheck and logrotate"
|
|
|
|
ansible.builtin.apt:
|
|
|
|
name:
|
|
|
|
- "logcheck"
|
|
|
|
- "logrotate"
|
|
|
|
|
2022-12-28 18:14:57 +01:00
|
|
|
- block:
|
|
|
|
|
|
|
|
- name: "identify logcheck ignore files"
|
2022-12-28 19:34:54 +01:00
|
|
|
delegate_to: "localhost"
|
2023-02-11 12:36:59 +01:00
|
|
|
become: false
|
2022-12-28 19:34:54 +01:00
|
|
|
ansible.builtin.stat:
|
2022-12-28 19:10:33 +01:00
|
|
|
path: "{{ system_base_logs_ignore_dir }}/{{ item }}"
|
2022-12-28 18:14:57 +01:00
|
|
|
register: system_base_logs_ignore_files_stat
|
|
|
|
loop: "{{ [ansible_hostname, 'all'] | union(group_names) }}"
|
|
|
|
|
|
|
|
- name: "configure logcheck ignores"
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "{{ system_base_logs_ignore_dir }}/{{ item }}"
|
|
|
|
dest: "/etc/logcheck/ignore.d.server/{{ item }}"
|
|
|
|
mode: 0644
|
|
|
|
loop: "{{ system_base_logs_ignore_files_stat.results | selectattr('stat.exists') |
|
|
|
|
map(attribute='item') }}"
|
|
|
|
|
|
|
|
when:
|
|
|
|
system_base_logs_ignore_dir is defined
|