Estimate time spent gathering facts across all hosts at the start of a playbook run.
Every play implicitly runs the `setup` module against each host unless `gather_facts: false` is set, and this cost scales like any other task: ceil(hosts / forks) batches × time per host. Fact caching (backed by redis, jsonfile, or memcached) lets Ansible skip re-gathering for hosts with a valid cache entry within the configured TTL, which this calculator models via a cache hit rate applied before batching.
total_fact_time_sec = ceil(hosts / forks) × gather_time_per_batch_sec
Yes, with `gather_facts: false`, but only if your playbook doesn't reference any `ansible_*` facts — many roles (package management, service handling) rely on facts like `ansible_os_family`, so disabling it entirely is often impractical.
Common values are 1-24 hours (`fact_caching_timeout` in ansible.cfg) — short enough that facts don't go stale after infrastructure changes, long enough to skip re-gathering across frequent, related playbook runs.
Yes — `gather_subset: min` or listing specific subsets (e.g. `!hardware`) gathers only the facts you actually need, which can meaningfully reduce per-host gather time versus the full fact set.
Fact caches are usually keyed by inventory hostname — if hosts are re-provisioned with new names/IPs frequently, or the cache backend has connectivity issues, hit rates drop and most runs fall back to a full gather.