ansible.builtin.fileglob filter – explode a path glob to matching files
Note
This filter plugin is part of ansible-core
and included in all Ansible
installations. In most cases, you can use the short
plugin name
fileglob
.
However, we recommend you use the Fully Qualified Collection Name (FQCN) ansible.builtin.fileglob
for easy linking to the
plugin documentation and to avoid conflicting with other collections that may have
the same filter plugin name.
Synopsis
Return a list of files that matches the supplied path glob pattern.
Filters run on the controller, so the files are matched from the controller’s file system.
Input
This describes the input of the filter, the value before | ansible.builtin.fileglob
.
Parameter |
Comments |
---|---|
Path glob pattern. |
Examples
# found = ['/etc/hosts', '/etc/hasts']
found: "{{ '/etc/h?sts' | fileglob }}"
Return Value
Key |
Description |
---|---|
List of files matched. Returned: success |
Hint
Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.