/fail2ban-ansible-modules

Ansible modules for configuring Fail2ban

Primary LanguagePythonMIT LicenseMIT

Build Status codecov

Fail2ban Ansible Modules

Ansible modules for configuring Fail2ban

Requirements

  • Python 3.5+
  • Ansible 2.5+

Modules

Jails

The fail2ban_jail.py module manages Fail2ban jails.

Examples

Add Jail
- 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.

Remove Jail
- name: remove ssh jail
  fail2ban_jail:
    name: ssh
    present: false
    jail_directory: /etc/fail2ban/jail.d
  notify: restart_fail2ban

License

MIT.