Skip to content

Commit

Permalink
Debug fail2ban
Browse files Browse the repository at this point in the history
  • Loading branch information
notthebee committed Apr 3, 2024
1 parent c706ec2 commit da8316c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions roles/fail2ban/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@
name: fail2ban
state: started
enabled: yes

- name: Check the fail2ban service status
register: fail2ban_service
ansible.builtin.systemd_service:
name: fail2ban

- name: Fail if fail2ban failed
ansible.builtin.assert:
that: fail2ban_service.StatusErrno != "0"
5 changes: 5 additions & 0 deletions roles/system/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Restart iptables
ansible.builtin.service:
name: iptables
state: restarted
1 change: 1 addition & 0 deletions roles/system/tasks/firewall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
cmd: "which iptables-restore"

- name: Template the iptables systemd service
notify: Restart iptables
ansible.builtin.template:
src: systemd/iptables.service.j2
dest: /etc/systemd/system/iptables.service
Expand Down

0 comments on commit da8316c

Please sign in to comment.