- name: Install fail2ban apt: pkg=fail2ban - name: Configure fail2ban template: src=etc/fail2ban/jail.local.j2 dest=/etc/fail2ban/jail.local owner=root group=root mode=0644 register: r notify: - Restart fail2ban - name: Start fail2ban service: name=fail2ban state=started when: not r.changed - meta: flush_handlers