common: remove fail2ban where CrowdSec agent and bouncer run, stop installing it

This commit is contained in:
2026-10-24 15:57:34 +00:00
parent fd58ee2c16
commit 19a62a43ca
3 changed files with 27 additions and 15 deletions
-5
View File
@@ -5,8 +5,3 @@
systemd: systemd:
name: systemd-journald name: systemd-journald
state: restarted state: restarted
- name: restart_fail2ban
systemd:
name: fail2ban
state: restarted
+27 -9
View File
@@ -1,9 +1,27 @@
# Debian 12+ ships no syslog daemon, so there is no /var/log/auth.log and the # CrowdSec reads the same logs and bans through its bouncers. fail2ban is
# file-based sshd jail refuses to start; read sshd from the journal instead. # removed only where both are running, so a host never ends up without a ban
- name: Read the sshd jail from the journal # mechanism.
copy: - name: Check the CrowdSec services
dest: /etc/fail2ban/jail.d/sshd-systemd.conf command: systemctl is-active crowdsec crowdsec-firewall-bouncer
content: | register: crowdsec_active
[sshd] changed_when: false
backend = systemd failed_when: false
notify: restart_fail2ban 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
-1
View File
@@ -16,5 +16,4 @@
- curl - curl
- rsync - rsync
- zstd - zstd
- fail2ban
state: latest state: latest