summaryrefslogtreecommitdiffstats
path: root/roles/common/tasks/logging.yml
blob: 9430d0bfef25b8c454e1973d254708a6b6b1d0d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
- name: Install logging server & utilities
  apt: pkg={{ item }}
  with_items:
    - rsyslog
    - syslog-summary
    - logcheck
    - logcheck-database
    - logrotate

- name: Configure rsyslog
  copy: src=etc/rsyslog.conf
        dest=/etc/rsyslog.conf
        owner=root group=root
        mode=0644
  register: r1
  notify:
    - Restart rsyslog
  tags:
    - syslog

- name: Configure postfix's custom rsyslog rules
  template: src=etc/rsyslog.d/postfix.conf.j2
            dest=/etc/rsyslog.d/postfix.conf
            owner=root group=root
            mode=0644
  register: r2
  notify:
    - Restart rsyslog
  tags:
    - syslog

- name: Start rsyslog
  service: name=rsyslog state=started
  when: not (r1.changed or r2.changed)
  tags:
    - syslog

- meta: flush_handlers

- name: Configure logcheck
  copy: src=etc/logcheck/{{ item }}
        dest=/etc/logcheck/{{ item }}
        owner=root group=logcheck
        mode=0644
  with_items:
    - logcheck.conf
    - ignore.d.server/common-local
    - ignore.d.server/dovecot-local
    - ignore.d.server/postfix-local
    # logcheck-sudo already exists, but changing the filename for our
    # local modifications would defeat the ruleset
    - violations.ignore.d/logcheck-sudo
  tags:
    - logcheck

- name: Minimal logging policy (1)
  lineinfile: dest=/etc/logrotate.d/rsyslog
              regexp="^/var/log/mail\\.(log|info|sasl)$"
              state=absent

- name: Minimal logging policy (2)
  copy: src=etc/logrotate.d/fripost-mail
        dest=/etc/logrotate.d/fripost-mail
        owner=root group=root
        mode=0644
  tags:
    - logrotate