summaryrefslogtreecommitdiffstats
path: root/roles/common/tasks/fail2ban.yml
blob: da4db511d6a4349d78d27f8f8a27754436ada2e8 (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
- name: Install fail2ban
  apt: pkg=fail2ban

- name: Add addititional filters
  copy: src=etc/fail2ban/filter.d/{{ item }}
        dest=/etc/fail2ban/filter.d/{{ item }}
        owner=root group=root
        mode=0644
  register: r1
  with_items:
    - dovecot.conf
    - roundcube.conf
  notify:
    - Restart fail2ban

- name: Configure fail2ban
  template: src=etc/fail2ban/jail.local.j2
            dest=/etc/fail2ban/jail.local
            owner=root group=root
            mode=0644
  register: r2
  notify:
    - Restart fail2ban

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

- meta: flush_handlers