DevOps / Ansible Interview questions
How does forking improve execution speed in Ansible?
By default, Ansible processes only 5 hosts at a time (forks = 5); for each task, it must finish running against all currently-active hosts (up to that limit) before starting the next batch, so with a large inventory, execution time scales roughly with (number of hosts / forks) rather than shrinking automatically as inventory grows.
# ansible.cfg [defaults] forks = 50
Increasing forks raises how many hosts the control node processes concurrently per task, which directly cuts total wall-clock time for large inventories, since more hosts are being worked on in parallel rather than queued waiting for a slot to free up. The practical ceiling is the control node's own resources: each fork consumes CPU, memory, and a network connection, so forks should be raised in proportion to what the control node (and target network/SSH capacity) can actually sustain, rather than set arbitrarily high, since an overloaded control node can end up slower overall from resource contention than a more conservative fork count.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
