How to run a task on a specific host which is not part of the hosts scope for the playbook?

What i am trying to achieve:

I have a playbook that provisions some virtual machines by running a role:

use delegate_to, that will run the task(s) on the delegated host.

I had ventured down that path but it failed with an SSL error that it could not verify.
But you had me look at this again and i found:

https://github.com/ansible/ansible/issues/18066

once i defined this entry in my hosts file:

localhost ansible_winrm_server_cert_validation=ignore

and added this to my play:

`

  • hosts: localhost
    gather_facts: true
    connection: local

`

then i tried a simple win_shell command:

`

  • name: windows delegate
    win_shell: echo “hello world” > C:\temp\delegate2.txt
    delegate_to: 192.168.111.13

`

which then worked!

it seems like its still a known issue in ansible v. 2.3 the fact that it doesn’t know what to do with winRM?

Thanks!