--- - name: Install and configure Fail2Ban hosts: all become: yes tasks: - name: Install fail2ban apt: name: fail2ban state: present update_cache: yes - name: Deploy jail.local copy: src: files/jail.local dest: /etc/fail2ban/jail.local owner: root group: root mode: '0644' - name: Restart fail2ban service: name: fail2ban state: restarted enabled: yes