diff --git a/playbooks/utils.yml b/playbooks/utils.yml index 7a7ae8c..661857d 100644 --- a/playbooks/utils.yml +++ b/playbooks/utils.yml @@ -327,10 +327,14 @@ changed_when: false when: utils_sshd_dropin is changed and not ansible_check_mode - - name: Reload sshd + # Restart, not reload: on the Debian 13 LXCs ssh.socket holds port 22 + # and passes it to sshd. A reload (SIGHUP) re-execs sshd without that + # socket, it fails to bind and dies. Open sessions survive a restart + # (KillMode=process), and systemd runs sshd -t first (ExecStartPre). + - name: Restart sshd ansible.builtin.systemd_service: name: ssh - state: reloaded + state: restarted when: utils_sshd_dropin is changed rescue: - name: Remove the drop-in that broke the sshd config @@ -340,7 +344,7 @@ - name: Stop on this host ansible.builtin.fail: - msg: "sshd -t failed with the hardening drop-in, so it was removed and sshd not reloaded." + msg: "sshd -t or the sshd restart failed with the hardening drop-in, so it was removed. Check `systemctl status ssh` on this host." # ------------------------------------------------------------ hostname # The inventory name is the hostname. k3s nodes and the Proxmox host are