Error when rebooting Windows server

Hello,

I have a server build yml file that I am using for AWX and at the end I am rebooting the server. When I run that command, I receive this.

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: ‘Connection’ object has no attribute ‘_winrm_host’

When I run as a single command, it works with no issues. Is it not possible to do this on a server build?

How exactly are you rebooting the server? (share the relevant bit of your playbook).

win_reboot module call is my current favourite way to do this.

If you don’t care to wait for the reboot to complete and for the machine to come back up, you can just run

  • name: final restart
    win_command: Restart-Computer -Force

Jon