blob: 563075f9941aea1cfce1c2497f40a96d83d0e0db (
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
|
- name: Install fail2ban
apt: pkg=fail2ban
- name: Configure fail2ban (fail2ban.local)
copy: src=etc/fail2ban/fail2ban.local
dest=/etc/fail2ban/fail2ban.local
owner=root group=root
mode=0644
register: r1
notify:
- Restart fail2ban
- name: Configure fail2ban (jail.local)
template: src=etc/fail2ban/jail.local.j2
dest=/etc/fail2ban/jail.local
owner=root group=root
mode=0644
register: r2
notify:
- Restart fail2ban
- name: Configure fail2ban (action.d/nftables-allports.local)
copy: src=etc/fail2ban/action.d/nftables-allports.local
dest=/etc/fail2ban/action.d/nftables-allports.local
owner=root group=root
mode=0644
register: r3
notify:
- Restart fail2ban
- name: Copy filters
copy: src=etc/fail2ban/filter.d/
dest=/etc/fail2ban/filter.d/
owner=root group=root
mode=0644
register: r4
notify:
- Restart fail2ban
- name: Create directory /etc/systemd/system/fail2ban.service.d
file: path=/etc/systemd/system/fail2ban.service.d
state=directory
owner=root group=root
mode=0755
- name: Harden fail2ban.service
copy: src=etc/systemd/system/fail2ban.service.d/override.conf
dest=/etc/systemd/system/fail2ban.service.d/override.conf
owner=root group=root
mode=0644
register: r5
notify:
- systemctl daemon-reload
- Restart fail2ban
- name: Start fail2ban
service: name=fail2ban state=started
when: not (r1.changed or r2.changed or r3.changed or r4.changed or r5.changed)
- meta: flush_handlers
- name: Delete /var/lib/fail2ban/fail2ban.sqlite3
file: path=/var/lib/fail2ban/fail2ban.sqlite3 state=absent
|