Make sshd restart handler multi-distro #4
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "sjat/make_users:multi-distro-sshd-service"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The restart handler hardcoded the service name
ssh, which only exists on Debian-family distros — on RedHat/Suse/Arch the unit issshd, so any sshd config change would fail the play there, despite the README describing the role as multi-distribution.Changes:
handlers/main.yaml: restart{{ users_sshd_service_name }}instead of hardcodedssh.defaults/main.yaml: newusers_sshd_service_namedefault —sshon Debian family,sshdelsewhere, overridable for exotic distros.tasks/main.yaml: gather minimal facts inside the role whenos_familyis missing (the play runs withgather_facts: false), taggedalwaysso it also runs under--tags sshd.README.md: one line documenting the auto-detection and override variable.Verified with
ansible-playbook --syntax-check, a test play rendering the name for Debian/RedHat/Suse/Archlinux fact values, andansible-lint(no findings in touched files).🤖 Generated with Claude Code