Hi,

You should use with_subelements like:

- name: remove unmanaged
  file:
    path: ...
    state: absent
    with_subelements:
    - found.results
    - stdout_lines
    when: item.1 not in configuration_files

Thanks.

2015年6月24日水曜日 18時26分26秒 UTC+9 Nico K.:

> Hi,
>
> I'm looping over a set of repositories and storing them using 'register', 
> for each of these repositories I'm listing the configuration directory and 
> storing the results using register, so far so good.
> Now I'm trying to compare the results against a list of configuration 
> files that should exist within that repository, but I can't seem to get 
> that done.
>
> What I'm trying to do:
>
> - name: check repos
>   shell: ls -1 {{ path }}/{{ item.name }}/{{ config_dir }}
>   register: found
>   with_items: repositories
>
> found, at this point contains 'x' repositories with 'y' files, 
> y.stdout_lines contains the files that were found for 'x'.
>
> The "cleanup" code I'm trying to write does something like:
>
> - name: remove unmanaged
>   file:
>     path: ...
>     state: absent
>   with_together:
>     - repositories
>     - found.results
>     - item.1.stdout_lines <--- these would be the actual file names
>   when: item.2 not in configuration_files
>
> Sadly, this doesn't seem to work.. how is one supposed to deal with this?
>
> Thanks,
> Nico
>

-- 
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/91a6ce74-64b5-4ee9-9b7d-77d08974f5ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to