Files
Wiki/Ansible/modules_plugins.md
Michael Schlapa 1f270317bb fileglob + example
2020-03-24 11:15:34 +01:00

35 lines
2.5 KiB
Markdown

# Modules
[All modules](https://docs.ansible.com/ansible/latest/modules/list_of_all_modules.html)
| 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. |
| [template](https://docs.ansible.com/ansible/latest/modules/template_module.html) | Template a file out to a remote server. |
| [unarchive](https://docs.ansible.com/ansible/latest/modules/unarchive_module.html) | Unpacks an archive after (optionally) copying it from the local machine. |
| [wait_for](https://docs.ansible.com/ansible/latest/modules/wait_for_module.html) | Waits for a condition before continuing. |
| [wait_for_connection](https://docs.ansible.com/ansible/latest/modules/wait_for_connection_module.html) | Waits until remote system is reachable/usable. |
# Plugins
| Plugin | Description |
|------------------------------------------------------------------------------------------|-----------------------------------|
| [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
```