2024-12-11 23:10:40 +01:00

39 lines
814 B
YAML
Executable File

- block:
- name: Install fail2ban packages
ansible.builtin.apt:
name:
- fail2ban
- sendmail
- name: Copy files
copy:
src: "{{ item }}"
dest: /etc/fail2ban/jail.d/
with_fileglob:
- "jail.d/*.conf"
- name: Copy files
copy:
src: "{{ item }}"
dest: /etc/fail2ban/filter.d/
with_fileglob:
- "filter.d/*.conf"
- name: Copy files
copy:
src: "{{ item }}"
dest: /etc/fail2ban/action.d/
with_fileglob:
- "action.d/*.conf"
- name: disable sendmail service
ansible.builtin.service:
name: sendmail.service
state: stopped
enabled: false
- name: Restart fail2ban service
ansible.builtin.service:
name: fail2ban.service
state: restarted
enabled: true
become: true