Event-Driven Ansible - ChatOps - From Chat to Action

September 1, 2023 by Nuno Martins

Like any well-rounded individual, in times of intense concentration, you will find me talking to myself in search of some hidden knowledge that I might have received in a dream, or perhaps quoting something from a fantasy novel about wizards and creatures in an attempt to fix a problem. Unfortunately, wearing a robe and shouting “Repairo Network!” while pointing my pen toward the device has yet to help in any situation.

At the 2023 AnsibleFest, as part of the main stage demonstration, I used the magic of Event-Driven Ansible to integrate ChatOps in our fictional infrastructure drama. ChatOps is not new, but I think it’s a pretty cool way to make changes or interact with your infrastructure.

We know that Event-Driven Ansible requires a source for events, a list of conditions which we call rulesets, and ultimately an action to match those conditions, which makes it perfect to use as a chatbot-type system.

For me to have a heart-to-heart with my beloved network, I will need to configure my chat as a source of events for Event-Driven Ansible, and to do this, I will use the webhook source plugin, which is part of the ansible.eda collection. Many enterprise chat platforms provide a method to send and receive webhooks to trigger words in the chat, which is perfect for what we want to do.

Event-Driven Ansible ChatOps mechanism

  • We will use an outgoing webhook from the chat application to Event-Driven Ansible.
  • Event-Driven Ansible will match the payload against its defined conditions.
  • Once a condition is met, the corresponding action will take place.
  • Feedback notification will be sent from the action as an incoming webhook to the chat.

Now that the fundamentals are done, let’s look at how we could use this. […]


Continue reading the article here:

You are welcome to reply to this topic to comment or discuss

3 Likes

To add to this, Nuno just put together this awesome video on YouTube (embedded here) around NetOps, ChatOps and Event-Driven Ansible :alarm_clock: 13 minutes

3 Likes