--- - name: install fail2ban on ubuntu >= 14.04 and debian >= 8 apt: pkg={{ item }} state=installed with_items: f2b_packages tags: fail2ban - name: Install the fail2ban custom jail file template: src=jail.local.j2 dest=/etc/fail2ban/jail.local owner=root group=root mode=444 notify: Restart fail2ban tags: fail2ban - name: Ensure that fail2ban is enabled and running service: name=fail2ban state=started enabled=yes