- name: Install fail2ban apt: name: [fail2ban, python3-systemd] state: present - name: Configure sshd jail template: src: fail2ban/sshd.local.j2 dest: /etc/fail2ban/jail.d/sshd.local owner: root group: root mode: "0644" notify: restart fail2ban - name: Enable fail2ban service: name: fail2ban state: started enabled: true