I’ve installed Win32 OpenSSH from Install Win32 OpenSSH · PowerShell/Win32-OpenSSH Wiki · GitHub on some Windows 2019 servers. Works fine so far. But now I’m stuck in the situation how to deploy a newer Win32 OpenSSH release via ansible itself on these servers. Since as soon as I start the update process the connection drops - sounds senible.
SSH is actually quite resilient when it comes to the service being restarted as Ansible will create a local socket to persist the connection between tasks and the connection doesn’t go down even if the main service is restarted. Even if it does fail you could look at using win_reboot to restart the host rather than restarting the service. It shouldn’t be needed but it’ll achieve the same thing just in a way that Ansible explicitly attempts to handle broken connections.