gather_facts¶
Collection Note
This module is part of the ansible.builtin collection. To install the collection, use:
Added in version2.8.
Synopsis¶
- This module takes care of executing the R(configured facts modules,FACTS_MODULES), the default is to use the M(ansible.builtin.setup) module.
- This module is automatically called by playbooks to gather useful variables about remote hosts that can be used in playbooks.
- It can also be executed directly by C(/usr/bin/ansible) to check what variables are available to a host.
- Ansible provides many I(facts) about the system, automatically.
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| parallel bool |
A toggle that controls if the fact modules are executed in parallel or serially and in order. This can guarantee the merge order of module facts at the expense of performance. By default it will be true if more than one fact module is used. For low cost/delay fact modules parallelism overhead might end up meaning the whole process takes longer. Test your specific case to see if it is a speed improvement or not. The C(ansible_facts_parallel) variable can be used to set this option, overriding the default, but not the direct assignment of the option in the task. |
Notes¶
Note
- This is mostly a wrapper around other fact gathering modules.
- Options passed into this action must be supported by all the underlying fact modules configured.
- If using O(ignore:gather_timeout) and parallel execution, it will limit the total execution time of modules that do not accept O(ignore:gather_timeout) themselves.
- Facts returned by each module will be merged, conflicts will favor 'last merged'. Order is not guaranteed, when doing parallel gathering on multiple modules.
Examples¶
# Display facts from all hosts and store them indexed by hostname at /tmp/facts.
# ansible all -m ansible.builtin.gather_facts --tree /tmp/facts
Authors¶
- Ansible Core Team