zuul-jobs/roles/validate-zone-db/tasks/find.yaml
Clark Boylan 4ed66807a0 Use unique loop vars to avoid conflicts
We have to be careful about avoiding outer loop loop_var conflicts in
ansible. Because the zuul-jobs roles are meant to be reconsumed
elsewhere we should not use 'item' loopvars and instead set them to
something a bit more unique.

We use a zj_ prefix to try and be unique to this repo and document this
convention.

Change-Id: I20b9327a914890e9eafcb2b36dc8c23fb472bc8f
2020-02-04 12:23:36 -08:00

15 lines
418 B
YAML

- name: Find zone files
find:
paths: '{{ zone_files }}'
patterns: 'zone.db'
recurse: yes
file_type: 'file'
register: zone_db_found_files
- name: Build zone.db file list
set_fact:
zone_db_files: '{{ zone_db_files + [ [zj_zone_db_found_file.path.split("/")[-2], zj_zone_db_found_file.path] ] }}'
loop: "{{ zone_db_found_files['files'] }}"
loop_control:
loop_var: zj_zone_db_found_file