We now proceed to callback plugins. One of the features that Ansible provides is a callback mechanism. You can configure as many callback plugins as required. These plugins can intercept events and trigger certain actions. The section on alerting that we will cover after this section shows you how to use these plugins to make sure you get the right sort of feedback. Let's see a simple example where we just print the run results at the end of the playbook run as part of a callback and then take a brief look at how to configure a callback.
We will rerun the build_agent
role from the last chapter for this example; the build agent is already configured and we're running Ansible against it. This is shown in the following screenshot:
As you can see in the preceding screenshot, the callback plugin resulted in an extra line called Run Results
, and printed a dictionary or hash of the actual results. You can utilize this information in a number of ways. Isn't this powerful? Are you...