Ansible modules for configuring Fail2ban
- Python 3.5+
- Ansible 2.5+
The fail2ban_jail.py
module manages Fail2ban jails.
- name: add ssh jail
fail2ban_jail:
name: ssh
enabled: true
port: ssh
filter: sshd
logpath: /var/log/auth.log
maxretry: 6
notify: restart_fail2ban
Note: enabled: false
does not remove the jail's configuration file. See Remove Jail for details on how
to do this.
- name: remove ssh jail
fail2ban_jail:
name: ssh
present: false
jail_directory: /etc/fail2ban/jail.d
notify: restart_fail2ban
MIT.