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

**URL:** <https://forum.ansible.com/t/how-to-run-a-task-on-a-specific-host-which-is-not-part-of-the-hosts-scope-for-the-playbook/24909>\
**Category:** Ansible Project\
**Created:** [July 6, 2017, 9:49am UTC](https://forum.ansible.com/t/how-to-run-a-task-on-a-specific-host-which-is-not-part-of-the-hosts-scope-for-the-playbook/24909 "2017-07-06T09:49:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rasmus\_Sjorslev](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@Rasmus\_Sjorslev](https://forum.ansible.com/u/Rasmus_Sjorslev)\
**Post date:** [July 6, 2017, 9:49am UTC](https://forum.ansible.com/t/how-to-run-a-task-on-a-specific-host-which-is-not-part-of-the-hosts-scope-for-the-playbook/24909/1 "2017-07-06T09:49:58Z")

</div>

What i am trying to achieve:

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

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [July 6, 2017, 7:19pm UTC](https://forum.ansible.com/t/how-to-run-a-task-on-a-specific-host-which-is-not-part-of-the-hosts-scope-for-the-playbook/24909/2 "2017-07-06T19:19:43Z")

</div>

use delegate\_to, that will run the task(s) on the delegated host.

---

<div class="post-metadata">

**Author:** ![Rasmus\_Sjorslev](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@Rasmus\_Sjorslev](https://forum.ansible.com/u/Rasmus_Sjorslev)\
**Post date:** [July 7, 2017, 12:33pm UTC](https://forum.ansible.com/t/how-to-run-a-task-on-a-specific-host-which-is-not-part-of-the-hosts-scope-for-the-playbook/24909/3 "2017-07-07T12:33:22Z")

</div>

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