ansible / ansible.builtin / v2.8.13 / lookup / fileglob list files matching a pattern | "added in version" 1.4 of ansible.builtin" Authors: Michael DeHaan <michael.dehaan@gmail.com>ansible.builtin.fileglob (v2.8.13) — lookup
pip
Install with pip install ansible==2.8.13
Matches all files in a single directory, non-recursively, that match a pattern. It calls Python's "glob" library.
- name: Display paths of all .txt files in dir debug: msg={{ lookup('fileglob', '/my/path/*.txt') }}
- name: Copy each file over that matches the given pattern copy: src: "{{ item }}" dest: "/etc/fooapp/" owner: "root" mode: 0600 with_fileglob: - "/playbooks/files/fooapp/*"
_terms: description: path(s) of files to read required: true
_list: description: - list of files