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 issue you have is that you have a invalid YAML document, if you use a site like 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.