Alan Orth
df26b6c17e
We should always restart fail2ban after updating the firewall. Also note that the order of execution of handlers depends on how they are defined in the handler config, not on the order they are listed in the task's notify statement. See: https://docs.ansible.com/ansible/latest/user_guide/playbooks_handlers.html
24 lines
674 B
YAML
24 lines
674 B
YAML
---
|
|
# file: roles/common/handlers/main.yml
|
|
|
|
- name: reload sshd
|
|
systemd: name={{ sshd_service_name }} state=reloaded
|
|
|
|
- name: reload sysctl
|
|
command: sysctl -p /etc/sysctl.conf
|
|
|
|
- name: restart firewalld
|
|
systemd: name=firewalld state=restarted
|
|
|
|
- name: reload systemd
|
|
systemd: daemon_reload=yes
|
|
|
|
- name: restart nftables
|
|
systemd: name=nftables state=restarted
|
|
|
|
# 2021-09-28: note to self to keep fail2ban at the end, as handlers are executed
|
|
# in the order they are defined, not in the order they are listed in the task's
|
|
# notify statement and we must restart fail2ban after updating the firewall.
|
|
- name: restart fail2ban
|
|
systemd: name=fail2ban state=restarted
|