- name: Install fail2ban packages apt: name: fail2ban state: present loop: - fail2ban - rsyslog - name: Configure fail2ban service template: src: jail.local.j2 dest: /etc/fail2ban/jail.local owner: root group: root mode: '0644' notify: restart-fail2ban