Can't use local_action in Windows playbook in devel?

496 views
Skip to first unread message

Frank Perks

unread,
Sep 9, 2015, 8:33:55 AM9/9/15
to Ansible Project
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 :(!

Brian Coca

unread,
Sep 9, 2015, 8:45:47 AM9/9/15
to Ansible Project
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.


--
Brian Coca

Frank Perks

unread,
Sep 9, 2015, 9:38:03 AM9/9/15
to Ansible Project
This is running latest version of devel (i updated this morning). 

delegate_to / connnection: local does not seem to work.

Trond Hindenes

unread,
Sep 9, 2015, 10:29:05 AM9/9/15
to Ansible Project
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.

Frank Perks

unread,
Sep 9, 2015, 10:44:35 AM9/9/15
to Ansible Project
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. 

Frank Perks

unread,
Sep 9, 2015, 11:46:39 AM9/9/15
to Ansible Project
Just to add something else, in 1.9.4 both Trond and my stuff works fine. 

Trond Hindenes

unread,
Sep 10, 2015, 4:09:20 AM9/10/15
to Ansible Project
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.

J Hawkesworth

unread,
Sep 10, 2015, 5:35:49 AM9/10/15
to Ansible Project
Looks like you have hit 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

Frank Perks

unread,
Sep 12, 2015, 6:18:58 PM9/12/15
to Ansible Project
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). 

Chris Church

unread,
Sep 17, 2015, 5:55:01 PM9/17/15
to ansible...@googlegroups.com
"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.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1f2359f7-1c80-4419-94b9-8e8dd656101f%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages