We have templates that have been saved with sysprep.
As I can with Ansible, after deploying the templates, wait for OS customization of sysprep to be completed.
I have seen the following article for powercli, but for Ansible ??
One thing you can do is make the opening of the connection (SSH/WinRM) the last step of the customization. You then have a task that waits for the connection to open which would mean the setup is complete.