Disabling Fact Gathering for Speed
Skip setup when you do not need facts.
Disabling Fact Gathering for Speed is a free DevOps Bootcamp lesson on CoddyKit. This is lesson 4 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, and your progress syncs across the web and the CoddyKit app. The DevOps Bootcamp course includes 4 lessons in total.
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: falseSee 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 = smartSmart 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:
- minGather 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. ✨
Learn DevOps Bootcamp with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 142
- Lessons
- 568
Frequently Asked Questions
Is the “Disabling Fact Gathering for Speed” lesson free?
Yes — any 3 lessons of the DevOps Bootcamp learning path, including “Disabling Fact Gathering for Speed”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The DevOps Bootcamp course includes 4 lessons in total.
What will I learn in “Disabling Fact Gathering for Speed”?
Skip setup when you do not need facts. You practise DevOps Bootcamp 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 DevOps Bootcamp?
No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 4 of 4.
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 DevOps Bootcamp lesson?
Yes. Every DevOps Bootcamp 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
- What Facts Are & Why They Matter
- Explore Facts with the setup Module
- Use ansible_facts in Tasks
- Disabling Fact Gathering for Speed