In this article, you will understand how Event Driven Ansible works in real life and across the overall Enterprise automation strategy using Ansible Automation Platform.
Challenges that ships with digital transformation
Digital business transformation has 2 key requirements:
- Lower cost
- Reduced risk with agility
In order to handle these requirements, the way traditional workflows were maintained is no longer the reality. There is a shift from traditional datacentres to private/public/hybrid cloud setup which enables agility, yet able to reduce the risk and improve reliability.
The infra requirements are dynamic, microservices interact over service mesh, audit logs are huge, monitoring data is so abundant that its consumption into meaningful actions leaves lot of toil and manual efforts.
Let’s take a specific example. There is an outage and there is multi-step, time-consuming semi-automated workflow that is used to resolve the issue. It can involve multiple actors who scramble through the logs as well as dashboards, so you are losing time at every step, because communications and notifications take time, then steps need to be completed and then things move on to the next step. Mean Time To Resolution (MTTR) is long.
That’s where Event Driven Automation is immensely useful.
What is Event Driven Automation
Ability to process events for discrete, actionable intelligence, then execute automated actions to respond to events and provide auditability across the automation landscape.
Event driven Automation comes to life with this Red Hat solution which works with similar constructs as Ansible Automation Platform, and it’s called Event driven Ansible.
What is Event Driven Ansible
Event Driven Ansible is a scalable solution that can automatically respond to “events” which are discrete, actionable pieces of intelligence about IT solutions that come from third party solutions such as monitoring and observability tools.
An example event may be a piece of intelligence detected by monitoring solution that a web server is not responding.
When receiving an event, Event Driven Ansible determines the appropriate and predefined response, then executes the specified automated actions for the event.
Let’s look at a working example to get familiar with the concept of Event Driven Ansible.
Subscribe to a event via webhook and act on a specific message:
Key building blocks of Event Driven Ansible
Here are the key building blocks for Event-Driven Ansible.
• SOURCES — EDA uses variety of events from available sources and you can create a custom source plugin too. These come from your multi-vendor environment i.e. the monitoring tools and other sources of data and intelligence you have about your environment.
• RULES — This is the key. You will create Ansible Rulebooks to document your knowledge about what you want to happen when a specific event occurs. These are written in simple, YAML-like language that is familiar to Ansible Automation Platform users. They create “If this then that” type structures that explain what to do when an event is encountered. Rules are flexible. The subject matter experts write them in simple language and changing them is easy if needs change as this is version controlled along with the other Infra/monitoring code. And, expansion to more Rulebooks for more events is also simple and cost-effective.
• ACTIONS — This is where the contents of the Ansible Rulebook are executed by Automation Controller to resolve the issue. Ansible Rulebooks can include actions to trigger Ansible Playbooks, for example if this condition exists, execute this existing Playbook. Or it can execute modules or even generate new events.
Let’s look at this example of using EDA with Kafka streams to solidify the understanding on key building blocks.
Subscribe to a event stream in Kafka and act on a specific message:
EDA + AAP = Next step in Enterprise automation strategy
AAP : Ansible Automation Platform is the enterprise Red Hat solution to automate tasks around Infra automation, Network automation, configuration management etc.
EDA which was in developer preview till early 2023, is now officially part of Ansible Automation Platform 2.4. It provides the similar object structures as AAP. So that means, the users can make use of EDA controllers as part of Automation Platform, and start with definition of rulebooks.
Based on the needs of the organization across Infra, Networking, Security, Application deployment or Cloud remediations, rulebooks can be easily crafted, sourced into VCS, and executed in EDA controller which comes as part of the AAP subscription.
Let’s look at the working demo on:
- How EDA controller integrates with AAP.
- Rulebooks for EDA which subscribe to monitoring alerts from Prometheus and take actions to reconcile machine state automatically.
I hope this was helpful in getting a quick introduction to Event Driven Ansible and how it can work with Red Hat Ansible Automation Platform.
Feel free to ask any questions. I am happy to answer any queries around the topic.
References:
Here are some resources to get started around this cool technology.
Red Hat Summit 2023 Announcement on EDA and key resources
10 ways to integrate event driven automation into IT operations
Note: This blog was written in September 2023 by Aditya Sharma and originates from Medium.
Tags:
Platform EngineeringSeptember 28, 2023