Using delegate_to: localhost on Windows servers not working as expected

Hi all,

I’ve got a playbook that I’ve run on some linux servers for a long time without issue. I’m trying to expand this to cover some windows servers but having an issue with delegate_to.

Basically, we need something that will

  • use localhost to check some ec2 instances are running, defined by a group in AWX
  • run patching command on each host in the group
  • use localhost to then shut some of the instances down

After a lot of mucking around some time ago I got this working with linux servers with the below playbook: