In a recent project aimed at enhancing automation capabilities and observability, I undertook integrating Ansible with OpenTelemetry to create a more robust event-driven architecture. This initiative was executed as a Microlab for the attendees of the Red Hat Summit Connect in Madrid, focusing on leveraging Ansible Automation Platform alongside OpenTelemetry to streamline operations and improve insights into automated processes.

You can check the code in my Github repository here

Overview

The primary goal of the integration was to utilize the Ansible Automation Platform, combined with OpenTelemetry using a Kafka topic as connector, to deliver seamless automation while simultaneously consuming rich telemetry data. This setup fosters better decision-making and more rapid troubleshooting during automated processes.

Prerequisites

To replicate the environment used in the lab, the following setups were established:

  • Ansible Automation Platform Controller Host: This is the cornerstone for managing and executing automation tasks.
  • Event-Driven Ansible Controller Host: Essential for implementing reactive automation patterns.
  • RHEL 9 Machine: Served as the platform to deploy the OpenTelemetry stack, vital for collecting telemetry data.
  • ServiceNow Test Instance: Used to simulate real-world service management scenarios and verify integration efficacy.

Installation Steps

The integration process involves several key actions:

Install Required Roles and Collections: Using ansible-galaxy, a robust tool for managing Ansible roles and collections, the prerequisites defined in the casc directory were installed.

1
2
3
4
```
cd casc
ansible-galaxy install -r requirements.yaml
```

Configuration Customization: A key customization step involved copying and renaming casc/vars/custom.yaml.template to casc/vars/custom.yaml. This file was subsequently edited to embed the environment-specific variables necessary for deployment.

Deployment Execution: With configurations in place, executing the following playbook initiated the deployment process:

1
2
3
4
5
```
mv vars/custom.yaml.template vars/custom.yaml
vi vars/custom.yaml
ansible-playbook casc/deploy.yaml
```

Benefits of Integration

The integration notably enhances both operational efficiency and observability. By using Event-Driven Ansible, processes can respond automatically to events or thresholds, reducing manual intervention and increasing resilience. Meanwhile, OpenTelemetry pass to Kafka feeds comprehensive telemetry data to monitoring systems, aiding swift problem detection and resolution. This information is consumed by a rulebook executed in our Event-Driven Ansible Activation Job.

Integrating these technologies with ServiceNow further complements the package by providing robust service management integration. The scenario tested in our lab demonstrated how tickets can be automatically generated upon specific telemetry thresholds or events detected by Ansible, illustrating a seamless closed-loop automation scenario.

Outcome and Conclusions

Through this microlab, I showed a simple platform where automation and observability coalesce effectively. This holistic approach allows teams to manage and scale operations with higher confidence and transparency. The deployment methodology using CasC adopted for the Microlab also showed applicability and effectiveness.

For a detailed walkthrough of the lab, including image snapshots and further technical details, please refer to our comprehensive lab guide. This guide encapsulates every step to enjoy this lab.

In conclusion, integrating Ansible with OpenTelemetry not only presents an advanced method for event-driven automation but also builds a tangible layer of observability and reaction capabilities in a simple way, necessary for modern, dynamic IT environments.