Book Image

Learning Ansible

By : Madhurranjan Mohaan, Ramesh Raithatha
Book Image

Learning Ansible

By: Madhurranjan Mohaan, Ramesh Raithatha

Overview of this book

<p>Automation includes provisioning new servers, making sure the servers adhere to their role and maintain the desired state from a configuration perspective, and orchestrating various actions across environments and deploying code as expected to all these servers. This is where Ansible steps in. It is secure, highly reliable, and minimalistic in nature. It automates configuration management, application deployment, and many other IT needs.</p> <p>Learning Ansible will equip you with the necessary skills to automate/improve your infrastructure from a configuration management perspective. You will also be able to use Ansible for one-click deployments, provisioning, and orchestrating your infrastructure.</p>
Table of Contents (16 chapters)
Learning Ansible
Credits
About the Authors
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Callback plugins


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...