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