Ansible Module find: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 9: Line 9:


=Example=
=Example=
<syntaxhighlight lang='yaml'>
<syntaxhighlight lang='yaml'>
- name: Find JetBrains applications
- name: Find JetBrains applications
Line 21: Line 20:
   register: intellij_apps
   register: intellij_apps
</syntaxhighlight>
</syntaxhighlight>
=Module Arguments=
==<tt>paths</tt>==
Each element listed here must be a directory.

Revision as of 04:20, 4 July 2021

External

Internal

Overview

Return a list of files based on specific criteria. Multiple criteria are ANDed together.

Example

- name: Find JetBrains applications
  find:
    paths: "{{ ansible_env.HOME }}/Library/Application Support/JetBrains/Toolbox/apps"
    recurse: yes
    patterns: '.history.json'
    hidden: yes
    file_type: file
    depth: 5
  register: intellij_apps

Module Arguments

paths

Each element listed here must be a directory.