this find
operation works.
- name: find stuff
hosts: "{{ targets | default('localhost') }}"
vars:
- search_path: /opt/db/postgres/tools/test_4_ansible
- search_term: "backup_archivelogs*sh"
- content: NODENAME
tasks:
- name: find script in {{ search_path }}
find:
path: "{{ search_path }}"
patterns: "{{ search_term }}" # "backup_archivelogs.*.sh"
contains: "{{ content }}" # NODENAME
register: findings
become: true
become_user: postgres
- name: show files found
debug:
var: item
loop: "{{ findings.files | map(attribute='path') | list }}"
now I am wondering how to find files matching patterns
but do NOT contain, NODENAME
(the string I was looking for in the contains
clause/argument/option) ?
I played a bit with !
but could not make it work.
any suggestions?