fail2ban/tasks/main.yml

45 lines
913 B
YAML
Raw Normal View History

2024-12-16 19:28:37 +01:00
---
- 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']