29 lines
630 B
YAML
29 lines
630 B
YAML
---
|
|
- name: Installer fail2ban
|
|
ansible.builtin.apt:
|
|
name: fail2ban
|
|
state: present
|
|
|
|
- name: Créer le répertoire jail.d
|
|
ansible.builtin.file:
|
|
path: /etc/fail2ban/jail.d
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
|
|
- name: Déployer la jail SSH Chezlepro
|
|
ansible.builtin.template:
|
|
src: sshd-chezlepro.local.j2
|
|
dest: /etc/fail2ban/jail.d/sshd-chezlepro.local
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
notify: Restart fail2ban
|
|
|
|
- name: Activer fail2ban
|
|
ansible.builtin.systemd:
|
|
name: fail2ban
|
|
enabled: true
|
|
state: started
|
|
when: fail2ban_ssh_enabled | bool
|