Tentative role for fail2ban

This commit is contained in:
2026-03-16 16:43:38 +01:00
parent 192c6f59bb
commit f36556a850
3 changed files with 39 additions and 0 deletions

View File

@@ -10,3 +10,12 @@ all:
debi13:
ansible_host: 127.0.0.1
ansible_port: 2224
fail2ban:
hosts:
debi13:
ansible_host: 127.0.0.1
ansible_port: 2224
alma9:
ansible_host: 127.0.0.1
ansible_port: 2222

10
playbooks/fail2ban.yml Normal file
View File

@@ -0,0 +1,10 @@
---
- name: Install fail2ban on Linux hosts
hosts:
- fail2ban
become: true
roles:
- fail2ban

View File

@@ -0,0 +1,20 @@
---
- name: Ensure epel-release is installed (RedHat)
ansible.builtin.package:
name: epel-release
state: present
update_cache: yes
when: ansible_os_family == 'RedHat'
- name: Ensure fail2ban is installed
ansible.builtin.package:
name: fail2ban
state: present
update_cache: yes
- name: Start fail2ban for RedHat
ansible.builtin.systemd_service:
name: fail2ban
state: started
enabled: true
when: ansible_os_family == 'RedHat'