ansible / ansible.builtin / v2.16.5 / lookup / fileglob list files matching a pattern | "added in version" 1.4 of ansible.builtin" Authors: Michael DeHaanansible.builtin.fileglob (v2.16.5) — lookup
pip
Install with pip install ansible-core==2.16.5
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 ansible.builtin.debug: msg={{ lookup('ansible.builtin.fileglob', '/my/path/*.txt') }}
- name: Copy each file over that matches the given pattern ansible.builtin.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 elements: path type: list