feat(fail2ban): add fail2ban_ignoreip to exempt trusted addresses
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 26s
Molecule / molecule (pull_request) Successful in 52s

Write fail2ban_ignoreip as ignoreip in the [DEFAULT] section of jail.local, so
it applies to every jail, the service jails in jail.d included. The default is
Fail2Ban's own (127.0.0.1/8 and ::1). Entries are validated (no whitespace,
\Z-anchored) because they are joined into one line.

The first run after upgrading adds the [DEFAULT] section and restarts Fail2Ban
once.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q72rsMCgwaR1sbYZangwbp
This commit is contained in:
DragonishandClaude Sonnet 5.5 committed 2026-11-15 11:55:17 +00:00
1 parent 263d892634
commit 57b15df1ac
8 files changed
+97 -2

No files matched your search

+14 -1
View File
@@ -4,7 +4,7 @@ argument_specs:
short_description: Install and configure Fail2Ban
description:
- >-
Installs fail2ban and python3-systemd, validates C(fail2ban_jails), writes /etc/fail2ban/jail.local, tests the
Installs fail2ban and python3-systemd, validates C(fail2ban_jails) and C(fail2ban_ignoreip), writes /etc/fail2ban/jail.local, tests the
configuration, ensures the service and checks that every enabled jail is loaded.
options:
fail2ban_package_name:
@@ -21,6 +21,19 @@ argument_specs:
Each item needs C(name), C(enabled), C(filter), C(maxretry), C(bantime) and C(findtime), plus one of
C(logpath), C(journalmatch) or C(backend) set to systemd.
- Optional keys are C(port) (default any), C(backend), C(journalmatch) and C(logpath).
fail2ban_ignoreip:
type: list
elements: str
default:
- 127.0.0.1/8
- "::1"
description:
- >-
Addresses, networks (CIDR) or hostnames that are never banned. Written as C(ignoreip) in the C([DEFAULT]) section of
jail.local, so it applies to every jail, the service jails in jail.d included. The default is Fail2Ban's own.
- >-
An empty list exempts nothing, loopback included. An entry must not contain whitespace (entries are joined with spaces).
- Changing it rewrites jail.local, which restarts Fail2Ban.
fail2ban_service:
type: dict
description: