Here is my playbook where i try to find test-juli.jar
under /app
directory however, i wish to exclude /app/Patchbackup
folder from the search.
Below is my playbook for the same:
tasks:
- name: Find test home directories under /app
find:
paths: /app
file_type: any
recurse: yes
depth: 4
patterns: 'test-juli.jar'
excludes: 'log,tmp,.installation,Patchbackup'
tags: always
register: tomjarfound
- debug:
msg: "ALL LISTED REFINED JARS: {{ item.path }}"
loop: "{{ tomjarfound.files }}"
When i run the above, i was expecting the find
not to find under /app/Patchbackup
but the output shows that it does despite being excluded.
Here is the output:
TASK [debug] ***********************************************************************************************************************************************************
ok: [10.0.0.11] => (item=/app/apache-test-9.0.10/bin/test-juli.jar) => {
"msg": "ALL LISTED REFINED JARS: /app/apache-test-9.0.10/bin/test-juli.jar"
}
ok: [10.0.0.11] => (item=/app/Patchbackup/app/apache-test-9.0.10/bin/test-juli.jar) => {
"msg": "ALL LISTED REFINED JARS: /app/Patchbackup/app/apache-test-9.0.10/bin/test-juli.jar"
}
Can you please suggest how can I exclude the folder /app/Patchbackup
from ansible's find ?