25 lines
506 B
YAML
25 lines
506 B
YAML
---
|
|
- name: Install fail2ban
|
|
ansible.builtin.apt:
|
|
name: fail2ban
|
|
state: present
|
|
update_cache: yes
|
|
become: yes
|
|
|
|
- name: Template fail2ban jail.local configuration
|
|
ansible.builtin.template:
|
|
src: jail.local.j2
|
|
dest: /etc/fail2ban/jail.local
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
become: yes
|
|
notify: Restart fail2ban
|
|
|
|
- name: Ensure fail2ban service is started and enabled
|
|
ansible.builtin.service:
|
|
name: fail2ban
|
|
state: started
|
|
enabled: yes
|
|
become: yes
|