0Pricing
Ansible Academy · Lesson

Disabling Fact Gathering for Speed

Skip setup when you do not need facts.

Disabling Fact Gathering for Speed is a free Ansible Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Ansible Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Facts Are Not Free

Gathering facts means an extra round trip to every host before your tasks run. On big fleets that adds up to real time. 🌟

When You Do Not Need Them

If a play never references a fact, gathering them is wasted work. You can safely turn the step off for that play.

The gather_facts Key

Set gather_facts to false at the play level and Ansible skips the Gathering Facts step entirely.

- hosts: web
  gather_facts: false

See the Difference

With it off, the play output no longer shows a Gathering Facts task. Your real tasks start immediately.

PLAY [web] *****
TASK [Install app] *****

Tune It Globally

You can change the default for all plays in ansible.cfg by setting gathering to a smarter mode like smart.

[defaults]
gathering = smart

Smart Gathering

The smart mode gathers facts once per host and reuses them, so repeat plays in the same run do not re-probe.

Gather Only a Subset

Instead of skipping everything, narrow it. The gather_subset option collects just the facts you actually use.

- hosts: web
  gather_subset:
    - min

Gather On Demand

Skipped facts but need them later? Add a setup task at the exact point you need them and gather just in time.

- ansible.builtin.setup:

Great for Quick Plays

Small plays that just restart a service or run one command rarely touch facts. Disabling gathering makes them noticeably faster.

Watch for Surprises

If a later task quietly relies on a fact, turning gathering off causes an undefined variable error. Disable only when you are sure.

Speed Versus Convenience

Default gathering is convenient; disabling it trades a little convenience for speed. Pick per play based on what it needs.

Quick Check

How do you stop a play from gathering facts?

Recap

You sped up plays by skipping facts with gather_facts: false, narrowing with gather_subset, and gathering on demand when needed. ✨

Frequently asked questions

Is the “Disabling Fact Gathering for Speed” lesson free?

Yes — the full text of “Disabling Fact Gathering for Speed” is free to read here on the web, and the Ansible Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Ansible Academy course, upgrade to CoddyKit PRO.

What will I learn in “Disabling Fact Gathering for Speed”?

Skip setup when you do not need facts. You practise Ansible Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Ansible Academy?

No prior experience is required. Ansible Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Disabling Fact Gathering for Speed” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Ansible Academy lesson?

Yes. Every Ansible Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. What Facts Are & Why They Matter
  2. Explore Facts with the setup Module
  3. Use ansible_facts in Tasks
  4. Disabling Fact Gathering for Speed
← Back to Ansible Academy