I have multiple config.properties
files in nested folder which contains my common configuration.
/myproject/env/dev/config.properties
:
LOG_PATH=/app/log
LOG_LEVEL=INFO
CLUSTER=ABC
NAMESPACE=dev
/myproject/env/test/config.properties
:
CLUSTER=ABC
NAMESPACE=test
I want to list the files for a set of keys like (LOG_PATH
) not available in config.properties
.
I am able to do positive lookup (contains: LOG_PATH
) in contains parameter but when I do negative lookup it shows me both file path as matched but I expect it should show just one path /test/config.properties
.
Is something wrong in my regex? I verified it using https://pythex.org and it works there. I also used DOTALL regex ^((?!LOG_PATH)[\\s][\\S])*$
findFiles-Playbook.yml
:
- hosts: localhost
gather_facts: false
tasks:
- name: List the file path which doesn't contains the content
find:
paths: /mrproject/env/
recurse: yes
follow: True
patterns: config.properties
use_regex: True
contains: LOG_PATH
#contains: ^((?!LOG_PATH).)*$ this Negative lookup doesn't works
register: matched_files
- name: print matches
debug:
var: matched_files