I am trying to reboot a windows server after installing .net + a bunch of dependencies. I have a super simple PS module to schedule a reboot. However afterwords i would like to wait for the WinRM connection to come back:
`
name: Configuring windows
hosts: windows
roles:
win_dotnet_46
win_nodejs
win_msvc
win_jdk
tasks:
name: Rebooting for .NET 4.6
win_reboot:
force: yes
name: Waiting for Windows Server to Come up
local_action: wait_for host={{ ansible_ssh_host }} port={{ ansible_ssh_port }} delay=30 timeout=300
`
However actually running this local_action seems to result in:
`
TASK [Waiting for Windows Server to Come up] ***********************************
fatal: [XXXXXXXXXX]: FAILED! => {“failed”: true, “msg”: “ERROR! The module wait_for was not found in configured module paths”}
`
I can use wait_for everywhere else, but not here :(!
Frank, I actually put a lot of work into the trondhindenes.win_reboot role you can find on Galaxy. WIth it you can force reboots, run reboots for nodes needing a reboot or whatever, and it will correctly run cooldown scripts and loop until it has a stable winrm service running before it will allow continuation. Maybe see if that solves this exact case for you?
as for connection: local, I’ve had far better results with delegate_to: localhost on the current devel branch.
I tried your module, and it fails with the same issue as above.
`
fatal: [52.8.31.205]: FAILED! => {“failed”: true, “msg”: “ERROR! The module stat was not found in configured module paths”}
`
I have found a really ugly way to get around it, and that is by simply defining another play with the wait_for winrm. Then starting another play for the remaining windows tasks.
delegate_to: localhost seems to work okay for most cases when working in a playbook. Unfortunately the solution doesn’t seem to work when doing it inside a role:
I get: “ERROR! The module wait_for was not found in configured module paths” Is there any other sort of workaround that exists (i cannot live without blocks anymore).