This commit is contained in:
un-oeil 2026-10-11 23:32:22 +02:00
parent 7d9ca062d9
commit 01d54e704b

View file

@ -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