Your indent for with_items is incorrect, it should be set on the task level 
and not module level, so

- name: get the files
  fetch:
    src: "C:/Temp/{{ item }}"
    dest: /home/vagrant/win-script-result/
    flat: yes
  with_items: "{{ results.stdout_lines }}"

I would also highly recommend swapping over to the win_find module instead 
of running that command. It gives you more control over what to find as you 
can add multiple regex strings to search and gives you room to expand in 
the future. This is what it would look like;

- name: find tar files
  win_find:
    paths: C:\temp
    file_type: file
    patterns: '*.tar'
  register: tar_files


- name: fetch tar files
  fetch:
    src: '{{ item.path }}'
    dest: /home/vagrant/win-script-result/
    flat: yes
  with_items: '{{ tar_files.files }}'

Both paths and patterns can take in a list so you can specify multiple 
paths and patterns instead of running separate tasks. It also gives you the 
ability to use regex if you really feel like hurting yourself :)

Thanks

Jordan

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/776415ba-99d5-495d-8ad0-22851df66bac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to