# Find and Fetch Files on Windows Hosts to Ansible Controller

**URL:** <https://forum.ansible.com/t/find-and-fetch-files-on-windows-hosts-to-ansible-controller/25717>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [October 11, 2017, 12:08am UTC](https://forum.ansible.com/t/find-and-fetch-files-on-windows-hosts-to-ansible-controller/25717 "2017-10-11T00:08:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcalfa1](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@marcalfa1](https://forum.ansible.com/u/marcalfa1)\
**Post date:** [October 11, 2017, 12:08am UTC](https://forum.ansible.com/t/find-and-fetch-files-on-windows-hosts-to-ansible-controller/25717/1 "2017-10-11T00:08:16Z")

</div>

I’m trying to find a few file patterns from a few windows hosts and copy those files to my ansible controller. Can some help me with the error message below. I can’t seem to figure out what I’m doing wrong.

ERROR! Syntax Error while loading YAML.

The error appears to have been in ‘/home/vagrant/ansible/test-win-find.yml’: line 14, column 6, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

flat: yes  
with\_items:  
^ here

---

<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 11, 2017, 5:06am UTC](https://forum.ansible.com/t/find-and-fetch-files-on-windows-hosts-to-ansible-controller/25717/2 "2017-10-11T05:06:06Z")

</div>

The issue you have is that you have a invalid YAML document, if you use a site like [http://yaml-online-parser.appspot.com/](http://yaml-online-parser.appspot.com/) it can test it for you. In your case, you with\_items is indented by too many spaces and should be in line with fetch.

When you fix that, the return value you are using in the fetch task is also wrong as win\_find does not have stdout\_lines as a return value. Have a look at the documentation to see how it returns the files it found [http://docs.ansible.com/ansible/latest/win\_find\_module.html](http://docs.ansible.com/ansible/latest/win_find_module.html).

Thanks

Jordan
