28 lines
681 B
YAML
28 lines
681 B
YAML
# CrowdSec reads the same logs and bans through its bouncers. fail2ban is
|
|
# removed only where both are running, so a host never ends up without a ban
|
|
# mechanism.
|
|
- name: Check the CrowdSec services
|
|
command: systemctl is-active crowdsec crowdsec-firewall-bouncer
|
|
register: crowdsec_active
|
|
changed_when: false
|
|
failed_when: false
|
|
check_mode: false
|
|
tags: fail2ban
|
|
|
|
- name: Stop and disable fail2ban
|
|
systemd:
|
|
name: fail2ban
|
|
state: stopped
|
|
enabled: false
|
|
when: crowdsec_active.rc == 0
|
|
failed_when: false
|
|
tags: fail2ban
|
|
|
|
- name: Remove fail2ban
|
|
apt:
|
|
name: fail2ban
|
|
state: absent
|
|
purge: true
|
|
when: crowdsec_active.rc == 0
|
|
tags: fail2ban
|