fail2ban/tasks/main.yml
2024-12-16 19:28:37 +01:00

45 lines
913 B
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
- name: 'fail2ban | apt update cache'
apt:
update_cache: yes
cache_valid_time: 86400 #One day
tags: ['fail2ban']
- name: 'fail2ban | install iptables packages'
apt:
name: "{{ item }}"
update_cache: true
state: present
with_items:
- fail2ban
tags: ['fail2ban']
- name: 'fail2ban | delete default config'
file:
path: "/etc/fail2ban/jail.d/defaults-debian.conf"
state: absent
notify:
- 'fail2ban | restart fail2ban'
tags: ['fail2ban']
- name: 'fail2ban | configuring fail2ban'
copy:
src: defaults.conf
dest: /etc/fail2ban/jail.d/defaults.conf
mode: 0644
force: yes
notify:
- 'fail2ban | restart fail2ban'
tags: ['fail2ban']
- name: 'fail2ban | enable sshd jail'
copy:
src: sshd.conf
dest: /etc/fail2ban/jail.d/sshd.conf
mode: 0644
force: yes
notify:
- 'fail2ban | restart fail2ban'
tags: ['fail2ban']