DevOps / Ansible Interview questions
Explain the lifecycle of a task in an Ansible play?
A single task moves through templating, module dispatch, execution, and result handling before Ansible considers it complete for a given host.
Before anything runs, Ansible evaluates the task's when condition (if any); if false, the task is marked skipped and nothing further happens for that host. Otherwise, module arguments are templated with Jinja2 using currently known variables and facts, and the module is dispatched to the host - respecting any become or delegate_to directives that change who executes it or where. The module runs its check-then-act logic and returns a result; if register is set, that result is stored in a variable for later tasks to reference, and if the task both notify-ed a handler and reported changed, that handler is queued to run at the end of the play. This entire sequence happens independently, per host, which is why a task can succeed on one host and fail on another within the same play.
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...
