robertdebock.fail2ban
Ansible Role: Fail2ban
This guide will help you install and set up Fail2ban on your system.
GitHub | GitLab | Downloads | Version |
---|---|---|---|
Example Playbook
The following example is from molecule/default/converge.yml
. It is tested with every update.
---
- name: Converge
hosts: all
become: true
gather_facts: true
roles:
- role: robertdebock.fail2ban
Before using the playbook, prepare the machine with molecule/default/prepare.yml
:
---
- name: Prepare
hosts: all
become: true
gather_facts: false
roles:
- role: robertdebock.bootstrap
- role: robertdebock.epel
For a full guide on using these roles, check out this link.
Role Variables
Default values for variables can be found in defaults/main.yml
:
---
# Default settings for Fail2ban
fail2ban_loglevel: INFO
fail2ban_logtarget: /var/log/fail2ban.log
fail2ban_ignoreself: "true"
fail2ban_ignoreips:
- "127.0.0.1/8 ::1"
# Times in seconds
fail2ban_bantime: 600
fail2ban_findtime: 600
fail2ban_maxretry: 5
fail2ban_destemail: root@localhost
fail2ban_sender: root@{{ ansible_fqdn }}
fail2ban_configuration: []
# - option: loglevel
# value: "INFO"
# section: Definition
fail2ban_jail_configuration: []
# - option: ignoreself
# value: "true"
# section: DEFAULT
Requirements
Make sure to install the pip packages listed in requirements.txt.
State of Used Roles
The following roles help prepare your system. You can choose another method if preferred.
Requirement | GitHub | GitLab |
---|---|---|
robertdebock.bootstrap | ||
robertdebock.epel |
Context
This role is part of many compatible roles. For more details, check the documentation at this website.
Here’s a look at the related roles:
Compatibility
This role has been tested with the following container images:
container | tags |
---|---|
EL | 9 |
Debian | all |
Fedora | all |
Ubuntu | all |
Ansible version 2.12 or higher is required. Tests have also been done on earlier and newer versions.
If you encounter any issues, please report them on GitHub.
License
This project is licensed under Apache-2.0.
Author Information
This role is created by robertdebock.
If you would like to support me, please consider sponsoring me.
Install and configure fail2ban on your system.
ansible-galaxy install robertdebock.fail2ban