Ansible Module fileglob: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 8: Line 8:


To iterate a list of files on a remote node, use the [[Ansible Module find|find]] module.
To iterate a list of files on a remote node, use the [[Ansible Module find|find]] module.
=Example=
<syntaxhighlight lang='yaml'>
- name: Find all module descriptors from a Java installation module file
  fileglob:
    _terms: /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home/jmods/*jmod
</syntaxhighlight>

Revision as of 09:01, 4 July 2021

External

Internal

Overview

A module that lists files matching a pattern. Patterns are only supported on files, not directory/paths. Matching is against local system files on the Ansible controller. Returns a string list of paths joined by commas, or an empty list if no files match. For a "true list" pass wantlist=True to the lookup.

To iterate a list of files on a remote node, use the find module.

Example

- name: Find all module descriptors from a Java installation module file
  fileglob:
    _terms: /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home/jmods/*jmod