2021-06-11 15:01:45 +02:00
|
|
|
---
|
2024-03-03 16:54:47 +01:00
|
|
|
- name: Install fail2ban and configure sshd
|
2024-02-23 12:19:48 +01:00
|
|
|
hosts: "{{ my_hosts | d([]) }}"
|
2024-03-03 16:16:22 +01:00
|
|
|
become: true
|
2024-03-03 16:34:29 +01:00
|
|
|
|
2021-06-11 15:01:45 +02:00
|
|
|
tasks:
|
2024-03-03 16:54:47 +01:00
|
|
|
- name: Install fail2ban
|
2024-03-03 16:10:27 +01:00
|
|
|
ansible.builtin.apt:
|
|
|
|
name:
|
|
|
|
- fail2ban
|
2024-03-03 16:16:22 +01:00
|
|
|
update_cache: true
|
2024-03-03 16:34:29 +01:00
|
|
|
|
2024-03-03 17:17:19 +01:00
|
|
|
- name: Copy fail2ban config file
|
2024-03-03 16:10:27 +01:00
|
|
|
ansible.builtin.copy:
|
|
|
|
src: configfiles/debian-sshd-default.conf
|
|
|
|
dest: /etc/fail2ban/jail.d/debian-sshd-default.conf
|
2024-03-03 17:17:19 +01:00
|
|
|
mode: '0644'
|
|
|
|
owner: root
|
|
|
|
group: root
|
2024-03-03 16:34:29 +01:00
|
|
|
|
2024-03-03 16:54:47 +01:00
|
|
|
- name: Restart fail2ban
|
2024-03-03 16:10:27 +01:00
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
state: restarted
|
2024-03-03 16:16:22 +01:00
|
|
|
daemon_reload: true
|
2024-03-03 16:10:27 +01:00
|
|
|
name: fail2ban
|