christianlempa-boilerplates/ansible/configuration/fail2ban/config-f2b-protect-sshd.yaml

26 lines
608 B
YAML
Raw Normal View History

2021-06-11 15:01:45 +02:00
---
- name: Install fail2ban and configure sshd
hosts: "{{ my_hosts | d([]) }}"
become: true
2021-06-11 15:01:45 +02:00
tasks:
- name: Install fail2ban
2024-03-03 16:10:27 +01:00
ansible.builtin.apt:
name:
- fail2ban
update_cache: true
- 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
mode: '0644'
owner: root
group: root
- name: Restart fail2ban
2024-03-03 16:10:27 +01:00
ansible.builtin.systemd_service:
state: restarted
daemon_reload: true
2024-03-03 16:10:27 +01:00
name: fail2ban