39 lines
814 B
YAML
Raw Normal View History

2024-12-11 16:35:32 +01:00
- block:
2024-12-11 23:10:40 +01:00
- name: Install fail2ban packages
2024-12-11 16:35:32 +01:00
ansible.builtin.apt:
name:
2024-12-11 23:10:40 +01:00
- fail2ban
- sendmail
- name: Copy files
2024-12-11 16:35:32 +01:00
copy:
2024-12-11 23:10:40 +01:00
src: "{{ item }}"
dest: /etc/fail2ban/jail.d/
with_fileglob:
- "jail.d/*.conf"
2024-12-11 16:35:32 +01:00
2024-12-11 23:10:40 +01:00
- name: Copy files
2024-12-11 16:35:32 +01:00
copy:
2024-12-11 23:10:40 +01:00
src: "{{ item }}"
dest: /etc/fail2ban/filter.d/
with_fileglob:
- "filter.d/*.conf"
2024-12-11 16:35:32 +01:00
2024-12-11 23:10:40 +01:00
- name: Copy files
copy:
src: "{{ item }}"
dest: /etc/fail2ban/action.d/
with_fileglob:
- "action.d/*.conf"
2024-12-11 16:35:32 +01:00
2024-12-11 23:10:40 +01:00
- name: disable sendmail service
ansible.builtin.service:
name: sendmail.service
state: stopped
enabled: false
2024-12-11 16:35:32 +01:00
2024-12-11 23:10:40 +01:00
- name: Restart fail2ban service
2024-12-11 16:35:32 +01:00
ansible.builtin.service:
2024-12-11 23:10:40 +01:00
name: fail2ban.service
2024-12-11 16:35:32 +01:00
state: restarted
2024-12-11 23:10:40 +01:00
enabled: true
2024-12-11 16:35:32 +01:00
become: true