1
0
Fork 0
forked from hmx/make_users
make_users/users/roles/users/handlers/main.yaml
sjat 8b02e0363f Make sshd restart handler multi-distro
The handler restarted the hardcoded service "ssh", which only exists on
Debian-family distros; on RedHat, Suse, Arch etc. the unit is "sshd",
so any sshd config change would fail there.

Pick the name via a new users_sshd_service_name default keyed off
ansible_facts['os_family'] (overridable for exotic distros). Since
site.yaml runs with gather_facts: false, the role now gathers minimal
facts itself when os_family is missing, tagged always so it also runs
under --tags sshd.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 13:47:31 +02:00

6 lines
116 B
YAML

---
- name: Restart sshd
ansible.builtin.service:
name: "{{ users_sshd_service_name }}"
state: restarted