On Tuesday, 27 November 2018 15:37:39 CET Dale Sykora wrote:
> ok: [ychtrn1d] => {
>     "msg": {
>         "changed": false,
>         "failed": false,
>         "files": [
>             {
>                 "creationtime": 1415372291.3851476,
>                 "filename": "administrator",
>                 "size": 3009061740
>             },
>             {
>                 "creationtime": 1247523608.929812,
>                 "filename": "Public",
>                 "size": 120599529
>             },
>             {
>                 "creationtime": 1415371442.8504908,
>                 "filename": "test",
>                 "size": 70521
>             }
>         ],
>         "matched": 3
>     }
> }
> 
> I want to loop through the 3 filename values, so I change playlist to
> 
> ---
> - name: Get folders under c:\Users
>   hosts: ychtrn1d
>   gather_facts: false
>   tasks:
>     - name: Determine which folders exist under Users
>       win_find:
>         paths: 'c:\Users\'
>         file_type: directory
>       register: folders
>     - debug:
>          msg: "{{ item }}"
>       loop: "{{ folders.files.filename }}"

loop takes a list and folders.files.filename is not a list but folders.files is 
so change to this

  - debug:
      msg: "{{ item.filename }}"
    loop: "{{ folders.files }}"

-- 
Kai Stian Olstad


-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5904643.nc8r8K9cTg%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to