find_a_file.yaml 561 B

1234567891011121314151617181920
  1. ---
  2. - name: find a specific file across hosts and return its host and path
  3. hosts: all
  4. collections:
  5. ansible.posix
  6. gather_facts: no
  7. become: true
  8. tasks:
  9. - name: run find command
  10. find:
  11. file_type: file
  12. # excludes: '/tmp,/sbin,/bin,/run,/media,/mnt,/proc,lost+found,/lib,/lib64,/srv,/sys,/boot,/dev'
  13. paths: /home,/root
  14. recurse: yes
  15. patterns: '*update.sh*'
  16. use_regex: no
  17. register: output
  18. - debug: var=item.path
  19. with_items: "{{ output.files }}"