22 lines
442 B
YAML
22 lines
442 B
YAML
|
|
---
|
||
|
|
- name: Install fail2ban
|
||
|
|
ansible.builtin.apt:
|
||
|
|
name: fail2ban
|
||
|
|
state: present
|
||
|
|
update_cache: true
|
||
|
|
|
||
|
|
- name: Configure the sshd jail
|
||
|
|
ansible.builtin.template:
|
||
|
|
src: fail2ban_sshd.local.j2
|
||
|
|
dest: /etc/fail2ban/jail.d/sshd.local
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: "0644"
|
||
|
|
notify: restart fail2ban
|
||
|
|
|
||
|
|
- name: Enable and start fail2ban
|
||
|
|
ansible.builtin.service:
|
||
|
|
name: fail2ban
|
||
|
|
enabled: true
|
||
|
|
state: started
|