# Can't use local\_action in Windows playbook in devel?

**URL:** <https://forum.ansible.com/t/cant-use-local-action-in-windows-playbook-in-devel/19214>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [September 9, 2015, 12:33pm UTC](https://forum.ansible.com/t/cant-use-local-action-in-windows-playbook-in-devel/19214 "2015-09-09T12:33:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frank\_Perks](https://avatars.discourse-cdn.com/v4/letter/f/90ced4/32.png) [@Frank\_Perks](https://forum.ansible.com/u/Frank_Perks)\
**Post date:** [September 9, 2015, 12:33pm UTC](https://forum.ansible.com/t/cant-use-local-action-in-windows-playbook-in-devel/19214/1 "2015-09-09T12:33:55Z")

</div>

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 :(!

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [September 9, 2015, 12:45pm UTC](https://forum.ansible.com/t/cant-use-local-action-in-windows-playbook-in-devel/19214/2 "2015-09-09T12:45:41Z")

</div>

What version of ansible? have you tried with connection: local or  
delegate\_to: localhost:?

It seems we lookup the module before making the connection local, in  
which case it is still looking for .ps1 files.

---

<div class="post-metadata">

**Author:** ![Frank\_Perks](https://avatars.discourse-cdn.com/v4/letter/f/90ced4/32.png) [@Frank\_Perks](https://forum.ansible.com/u/Frank_Perks)\
**Post date:** [September 9, 2015, 1:38pm UTC](https://forum.ansible.com/t/cant-use-local-action-in-windows-playbook-in-devel/19214/3 "2015-09-09T13:38:03Z")

</div>

This is running latest version of devel (i updated this morning).

delegate\_to / connnection: local does not seem to work.

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [September 9, 2015, 2:29pm UTC](https://forum.ansible.com/t/cant-use-local-action-in-windows-playbook-in-devel/19214/4 "2015-09-09T14:29:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Frank\_Perks](https://avatars.discourse-cdn.com/v4/letter/f/90ced4/32.png) [@Frank\_Perks](https://forum.ansible.com/u/Frank_Perks)\
**Post date:** [September 9, 2015, 2:44pm UTC](https://forum.ansible.com/t/cant-use-local-action-in-windows-playbook-in-devel/19214/5 "2015-09-09T14:44:35Z")

</div>

Hi Trond,

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.

---

<div class="post-metadata">

**Author:** ![Frank\_Perks](https://avatars.discourse-cdn.com/v4/letter/f/90ced4/32.png) [@Frank\_Perks](https://forum.ansible.com/u/Frank_Perks)\
**Post date:** [September 9, 2015, 3:46pm UTC](https://forum.ansible.com/t/cant-use-local-action-in-windows-playbook-in-devel/19214/6 "2015-09-09T15:46:38Z")

</div>

Just to add something else, in 1.9.4 both Trond and my stuff works fine.

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [September 10, 2015, 8:09am UTC](https://forum.ansible.com/t/cant-use-local-action-in-windows-playbook-in-devel/19214/7 "2015-09-10T08:09:20Z")

</div>

That is very strange. I spent a lot of time making sure it would work in both 1.9 and 2.0. Will test and report back.

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [September 10, 2015, 9:35am UTC](https://forum.ansible.com/t/cant-use-local-action-in-windows-playbook-in-devel/19214/8 "2015-09-10T09:35:49Z")

</div>

Looks like you have hit [https://github.com/ansible/ansible/issues/12053](https://github.com/ansible/ansible/issues/12053)

changing over to  
delegate\_to: localhost

will likely work around the problem for now, until the above can be fixed.

Jon

---

<div class="post-metadata">

**Author:** ![Frank\_Perks](https://avatars.discourse-cdn.com/v4/letter/f/90ced4/32.png) [@Frank\_Perks](https://forum.ansible.com/u/Frank_Perks)\
**Post date:** [September 12, 2015, 10:18pm UTC](https://forum.ansible.com/t/cant-use-local-action-in-windows-playbook-in-devel/19214/9 "2015-09-12T22:18:58Z")

</div>

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:

`

- wait\_for host={{ ansible\_ssh\_host }} port={{ ansible\_ssh\_port }} delay=30 timeout=300  
delegate\_to: localhost

`

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).

---

<div class="post-metadata">

**Author:** ![Chris\_Church1](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@Chris\_Church1](https://forum.ansible.com/u/Chris_Church1)\
**Post date:** [September 17, 2015, 9:54pm UTC](https://forum.ansible.com/t/cant-use-local-action-in-windows-playbook-in-devel/19214/10 "2015-09-17T21:54:34Z")

</div>

"local\_action" and "delegate\_to: localhost" should both be working again  
with Windows hosts.

There may still be another issue delegating to another host, which is being  
tracked by [https://github.com/ansible/ansible/issues/12370](https://github.com/ansible/ansible/issues/12370).
