Instead, set module_defaults at the play level, which will apply to the
gather_facts keyword as well as any
ansible.builtin.setup/ansible.builtin.gather_facts tasks.
- hosts: all
gather_facts: yes
module_defaults:
ansible.builtin.setup:
fact_path: /path/to/facts.d/
gather_subset: '!all,!min,local'
gather_timeout: 20
tasks:
# also applies to:
- ansible.builtin.setup:
- ansible.builtin.gather_facts:
If you wish to only apply these to the gather_facts keyword, set as play keywords.
- "This option allows you to globally configure a custom path for 'local_facts' for the implied :ref:`ansible_collections.ansible.builtin.setup_module` task when using fact gathering."
- "If not set, it will fall back to the default from the ``ansible.builtin.setup`` module: ``/etc/ansible/facts.d``."
- "This does **not** affect user defined tasks that use the ``ansible.builtin.setup`` module."
- The real action being created by the implicit task is currently ``ansible.legacy.gather_facts`` module, which then calls the configured fact modules,
by default this will be ``ansible.builtin.setup`` for POSIX systems but other platforms might have different defaults.
env:[{name:ANSIBLE_FACT_PATH}]
ini:
- {key: fact_path, section:defaults}
type:string
deprecated:
# TODO: when removing set playbook/play.py to default=None
why:the module_defaults keyword is a more generic version and can apply to all calls to the
M(ansible.builtin.gather_facts) or M(ansible.builtin.setup) actions
implicit:"the cache plugin will be ignored and facts will be gathered per play unless 'gather_facts: False' is set."
implicit:"the cache plugin will be ignored and facts will be gathered per play unless 'gather_facts: False' is set."
explicit:facts will not be gathered unless directly requested in the play.
explicit:facts will not be gathered unless directly requested in the play.
smart:each new host that has no facts discovered will be scanned, but if the same host is addressed in multiple plays it will not be contacted again in the run.
smart:each new host that has no facts discovered will be scanned, but if the same host is addressed in multiple plays it will not be contacted again in the run.
DEFAULT_GATHER_SUBSET:
name:Gather facts subset
description:
- Set the `gather_subset` option for the :ref:`ansible_collections.ansible.builtin.setup_module` task in the implicit fact gathering.
See the module documentation for specifics.
- "It does **not** apply to user defined ``ansible.builtin.setup`` tasks."
env:[{name:ANSIBLE_GATHER_SUBSET}]
ini:
- key:gather_subset
section:defaults
version_added:"2.1"
type:list
deprecated:
# TODO: when removing set playbook/play.py to default=None
why:the module_defaults keyword is a more generic version and can apply to all calls to the
M(ansible.builtin.gather_facts) or M(ansible.builtin.setup) actions
version:"2.18"
alternatives:module_defaults
DEFAULT_GATHER_TIMEOUT:
name:Gather facts timeout
description:
- Set the timeout in seconds for the implicit fact gathering, see the module documentation for specifics.
- "It does **not** apply to user defined :ref:`ansible_collections.ansible.builtin.setup_module` tasks."
env:[{name:ANSIBLE_GATHER_TIMEOUT}]
ini:
- {key: gather_timeout, section:defaults}
type:integer
deprecated:
# TODO: when removing set playbook/play.py to default=None
why:the module_defaults keyword is a more generic version and can apply to all calls to the
M(ansible.builtin.gather_facts) or M(ansible.builtin.setup) actions