# Having issue finding my hosts

**URL:** <https://forum.ansible.com/t/having-issue-finding-my-hosts/25825>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [October 25, 2017, 11:48pm UTC](https://forum.ansible.com/t/having-issue-finding-my-hosts/25825 "2017-10-25T23:48:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [October 25, 2017, 11:48pm UTC](https://forum.ansible.com/t/having-issue-finding-my-hosts/25825/1 "2017-10-25T23:48:06Z")

</div>

I think you are misusing the directives:

- hosts: /ansible/hosts \<= this will NOT use that file as inventory  
for the play.

The hosts keyword is supposed to be a 'pattern', not a file nor  
inventory source.

to use that as your inventory you can do:  
ansible-playbook /ansible/playbook/test.yml -i /ansible/hosts

and set hosts: to 'all'

- hosts: all

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [October 26, 2017, 7:57pm UTC](https://forum.ansible.com/t/having-issue-finding-my-hosts/25825/2 "2017-10-26T19:57:42Z")

</div>

YAML does not handle \ very well as it is an escaping character in most situations. When defining tasks I would highly recommend using the YAML for instead of the older key=arg form as it makes your code more readable and you don’t have to escape . Your task would now look like this

- name: Copies file to Windows  
win\_copy:  
src: /ansible/ansible.cfg  
dest: C:\Users\YRunner\Desktop\test1

When using the YAML form, you don’t need to escape \ unless you have double quoted the value. I found you don’t need to quote a value unless you want to convert it to a string or it contains a :.

This has more info on this particular topic [http://docs.ansible.com/ansible/devel/windows\_usage.html#path-formatting-for-windows](http://docs.ansible.com/ansible/devel/windows_usage.html#path-formatting-for-windows).

Thanks

Jordan

---

<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:** [October 26, 2017, 8:06pm UTC](https://forum.ansible.com/t/having-issue-finding-my-hosts/25825/3 "2017-10-26T20:06:16Z")

</div>

I think the \t in your path will be interpreted as a tab character, which is not valid in a Windows path.

It's best to use key: value syntax when working with Windows paths, rather than the key=value style.

Generally, for hard coded windows paths they will work fine if you use key: value and enter the path in single quotes.

Hope this helps,

Jon

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [October 26, 2017, 11:21pm UTC](https://forum.ansible.com/t/having-issue-finding-my-hosts/25825/4 "2017-10-26T23:21:24Z")

</div>

What I gave you is just the task to use in place of your win\_copy one. You still need to specify the other playbook directives like hosts, tasks, roles and the like.

Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![Zimidar\_Boy](https://avatars.discourse-cdn.com/v4/letter/z/0ea827/32.png) [@Zimidar\_Boy](https://forum.ansible.com/u/Zimidar_Boy)\
**Post date:** [October 30, 2017, 4:29pm UTC](https://forum.ansible.com/t/having-issue-finding-my-hosts/25825/5 "2017-10-30T16:29:29Z")

</div>

Hello Larry,  
Any task in ansible comes under task module i think so your script will look like this:

- hosts: nuc

tasks:

- name: run simple script

script: C:\Users\YRunner\Desktop\lp1.bat
