fileglob + example
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
| Module | Description |
|
||||
|------------------------------------------------------------------------------------------|------------------------------------------------|
|
||||
| [file](https://docs.ansible.com/ansible/latest/modules/file_module.html) | Manage files and file properties. |
|
||||
| [gather_facts](https://docs.ansible.com/ansible/latest/modules/gather_facts_module.html) | Gathers facts about remote hosts. |
|
||||
| [lineinfile](https://docs.ansible.com/ansible/latest/modules/lineinfile_module.html) | Manage lines in text files. |
|
||||
| [seport](https://docs.ansible.com/ansible/latest/modules/seport_module.html) | Manages SELinux network port type definitions. |
|
||||
| [systemd](https://docs.ansible.com/ansible/latest/modules/systemd_module.html) | Manage services. |
|
||||
@@ -14,4 +15,21 @@
|
||||
# Plugins
|
||||
| Plugin | Description |
|
||||
|------------------------------------------------------------------------------------------|-----------------------------------|
|
||||
| [gather_facts](https://docs.ansible.com/ansible/latest/modules/gather_facts_module.html) | Gathers facts about remote hosts. |
|
||||
| [fileglob](https://docs.ansible.com/ansible/latest/plugins/lookup/fileglob.html) | List files matching a pattern. |
|
||||
|
||||
# Examples
|
||||
|
||||
## fileglob
|
||||
|
||||
`fileglob` returns a comma-separated string of files matching the search string. If you append `wantlist=True` you'll get a real list. `delegate_to: localhost` lets you search on the host you're running Ansible on.
|
||||
|
||||
```
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
|
||||
tasks:
|
||||
- name: "Bla"
|
||||
debug:
|
||||
msg: "{{ lookup('fileglob', '/any/path/files/rpms/*.rpm', wantlist=True) }}"
|
||||
delegate_to: localhost
|
||||
```
|
||||
Reference in New Issue
Block a user