ansible-roles/fail2ban/tasks/main.yml

48 lines
860 B
YAML

---
# We have to copy the local jail before installing the package
# or we risk being jailed by fail2ban
- name: Prepare /etc/fail2ban
file:
path: /etc/fail2ban
state: directory
owner: root
group: root
mode: "0755"
tags:
- fail2ban
- name: local jail is installed
template:
src: jail.local.j2
dest: /etc/fail2ban/jail.local
mode: "0644"
force: no
notify: restart fail2ban
tags:
- fail2ban
- name: custom filters are installed
copy:
src: "{{ item }}"
dest: /etc/fail2ban/filter.d/
mode: "0644"
with_items:
- dovecot-evolix.conf
- sasl-evolix.conf
- wordpress-soft.conf
- wordpress-hard.conf
- roundcube.conf
notify: restart fail2ban
tags:
- fail2ban
- name: package is installed
apt:
name: fail2ban
state: present
tags:
- fail2ban
- packages