ansible-roles/system/base/logs/tasks/main.yml

29 lines
846 B
YAML

---
- name: "install logcheck and logrotate"
ansible.builtin.apt:
name:
- "logcheck"
- "logrotate"
- block:
- name: "identify logcheck ignore files"
delegate_to: "localhost"
become: false
ansible.builtin.stat:
path: "{{ system_base_logs_ignore_dir }}/{{ item }}"
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 }}"
group: "logcheck"
mode: 0644
loop: "{{ system_base_logs_ignore_files_stat.results | selectattr('stat.exists') |
map(attribute='item') }}"
when:
system_base_logs_ignore_dir is defined