You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.yml 716 B

1 year ago
12345678910111213141516171819202122232425262728
  1. ---
  2. - name: Install fail2ban
  3. yum: name=fail2ban state=present
  4. when: ansible_distribution == 'CentOS'
  5. - name: Install fail2ban
  6. apt: name=fail2ban state=present
  7. when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
  8. - name: Enable fail2ban
  9. service: name=fail2ban enabled=yes
  10. - name: Create jail.d
  11. file: path=/etc/fail2ban/jail.d state=directory
  12. - name: Setup filters
  13. template: src="{{item}}-filter.conf.j2" dest="/etc/fail2ban/filter.d/{{item}}.conf"
  14. with_items:
  15. - nginx-proxy
  16. notify:
  17. - restart fail2ban
  18. - name: setup jails
  19. template: src="{{item}}-jail.conf.j2" dest="/etc/fail2ban/jail.d/{{item}}.conf"
  20. with_items:
  21. - nginx-proxy
  22. notify:
  23. - restart fail2ban