--- # Fail2ban Configuration Tasks - name: Ensure fail2ban is installed ansible.builtin.apt: name: fail2ban state: present - name: Configure fail2ban ansible.builtin.template: src: fail2ban.local.j2 dest: /etc/fail2ban/jail.local owner: root group: root mode: '0644' notify: restart fail2ban - name: Ensure fail2ban is started and enabled ansible.builtin.systemd: name: fail2ban state: started enabled: yes