Created
July 31, 2018 16:26
-
-
Save piotr-gbyliczek/482f5cedf36955daa25b94f53b180485 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: find dirs to scan | |
find: | |
file_type: directory | |
path: "{{ item.dir }}" | |
patterns: "{{ item.pattern }}" | |
use_regex: yes | |
register: directories | |
with_items: "{{ dynamic_directories }}" | |
- name: find files to remove | |
find: | |
file_type: file | |
path: "{{ item }}" | |
recurse: yes | |
register: files_for_removal | |
with_items: | |
- "{{ static_directories }}" | |
- name: find files to remove in directories to scan | |
find: | |
file_type: file | |
path: "{{ item.files.path }}" | |
recurse: yes | |
register: files_for_removal_in_dirs_to_scan | |
with_items: | |
- "{{ directories.results }}" | |
- name: remove files | |
file: | |
state: absent | |
path: "{ item.item.path }}" | |
follow: true | |
with_items: | |
- "{{ files_for_removal.results }}" | |
- "{{ files_for_removal_in_dirs_to_scan.results }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment