--- argument_specs: main: short_description: Install and configure Fail2Ban description: - >- Installs fail2ban and python3-systemd, validates C(fail2ban_jails), writes /etc/fail2ban/jail.local, tests the configuration, ensures the service and checks that every enabled jail is loaded. options: fail2ban_package_name: type: str default: fail2ban description: - Name of the Fail2Ban package. fail2ban_jails: type: list elements: dict description: - Jails written to jail.local. The role default is a single C(sshd) jail on the systemd backend. - >- 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_service: type: dict description: - Service management. The role default is C(enabled=true), C(state=started). Missing keys fall back to those values. - Enabled jails are only checked with fail2ban-client when state is started. options: enabled: type: bool description: Whether the service starts at boot. state: type: str description: Desired systemd state of the service, for example started or stopped. fail2ban_defaults: type: dict description: - >- Fallback C(maxretry), C(bantime) and C(findtime). The role default is 5, 600 and 600. Only used by the service_jail entry point; main-entry jails must set all three (C(tasks/validate.yml) asserts them), so there the fallback only applies when validation is skipped, for example under C(--tags fail2ban_configure). options: maxretry: type: int description: Fallback number of failures before a ban. bantime: type: raw description: Fallback ban duration, seconds or a Fail2Ban time string. findtime: type: raw description: Fallback window in which failures are counted, seconds or a Fail2Ban time string. service_jail: short_description: Deploy one service jail and filter into jail.d description: - Entry point for a service role that owns its jail, used with C(include_role) and C(tasks_from=service_jail). - >- Installs Fail2Ban, writes /etc/fail2ban/filter.d/.conf and /etc/fail2ban/jail.d/.local, reloads Fail2Ban and tests the configuration. It never touches jail.local. options: fail2ban_package_name: type: str default: fail2ban description: - Name of the Fail2Ban package installed by this entry point. fail2ban_service_name: type: str required: true description: - Service name, used as the jail section name and the file names under filter.d and jail.d. fail2ban_service_jail: type: raw required: true description: - >- Mapping describing the jail. Must contain C(logpath) or C(journalmatch). Optional keys are C(enabled) (default true), C(port) (default any), C(filter) (default the service name), C(backend) (default systemd, only used with journalmatch), C(maxretry), C(bantime) and C(findtime), which fall back to C(fail2ban_defaults). - Typed raw because callers pass a templated variable, for example C(gitea_fail2ban_jail). It is asserted to be a mapping. fail2ban_service_filter: type: raw required: true description: - Mapping with C(failregex) (required) and C(ignoreregex) (optional, default empty). - Typed raw because callers pass a templated variable. It is asserted to be a mapping. fail2ban_defaults: type: dict description: - Fallback C(maxretry), C(bantime) and C(findtime), read from the role defaults. options: maxretry: type: int description: Fallback number of failures before a ban. bantime: type: raw description: Fallback ban duration. findtime: type: raw description: Fallback failure counting window.