Ansible Module find: Difference between revisions
Jump to navigation
Jump to search
(→depth) |
|||
Line 25: | Line 25: | ||
Each element listed here must be a directory. | Each element listed here must be a directory. | ||
==<tt>recurse</tt>== | ==<tt>recurse</tt>== | ||
If target is a directory, recursively descend into the directory looking for files. Values: <code>yes</code>, <code>no</code>. Default is <code>no</code>. | |||
==<tt>patterns</tt>== | ==<tt>patterns</tt>== | ||
==<tt>file_type</tt>== | ==<tt>file_type</tt>== | ||
==<tt>depth</tt>== | ==<tt>depth</tt>== | ||
An integer that specifies the maximum number of levels to descend into. Setting [[#recurse|recurse]] to no will override this value, which is effectively depth 1. Default is unlimited depth. | An integer that specifies the maximum number of levels to descend into. Setting [[#recurse|recurse]] to no will override this value, which is effectively depth 1. Default is unlimited depth. |
Revision as of 09:17, 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.
recurse
If target is a directory, recursively descend into the directory looking for files. Values: yes
, no
. Default is no
.
patterns
file_type
depth
An integer that specifies the maximum number of levels to descend into. Setting recurse to no will override this value, which is effectively depth 1. Default is unlimited depth.