Chapter 4. Controlling Task Conditions

Ansible fundamentally operates on the concept of task statuses: ok, changed, failed, or skipped. These statuses determine whether any further tasks should be executed on a host and handlers should be notified due of any changes. Tasks can also make use of conditionals that check the status of previous tasks to control operation.

In this chapter, we'll explore ways to influence Ansible when determining the task status:

  • Controlling what defines a failure
  • Recovering gracefully from a failure
  • Controlling what defines a change

Defining a failure

Most modules that ship with Ansible have an opinion on what constitutes an error. An error condition is highly dependent upon the module and what the module is attempting to ...

Get Mastering Ansible - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.