Gathering facts takes minutes on 500 hosts and you only need the OS family.
IntermediateScenarioVariables, Facts and Templates
Answer
Situation read → Fact gathering is overkill.
What I'd do →
- hosts: all
gather_facts: false
tasks:
- ansible.builtin.setup:
gather_subset: [min]
filter: ansible_os_family
Or set gather_subset = min in ansible.cfg, and enable fact caching.
Why → The full subset runs hardware and network probes you rarely need.
Interview tip → gather_facts: false on plays that never use facts is free speed.
More on Variables, Facts and Templates
A variable you set in `group_vars` is being overridden and you do not know where. How do you find the source?IntermediateYou need different values per environment without copying playbooks.BeginnerYou must render an Nginx config with one `server` block per site from a list.IntermediateA template needs the IPs of all hosts in the `db` group, for example for a replication config.IntermediateNothing should be rendered unless a mandatory variable is supplied.BeginnerPer-host values, like `server_id` for MySQL, must be unique and stable.Intermediate