Original post: https://blog.while-true-do.io/spotlight-ara-records-ansible/
Introduction
Are you an avid Ansible user? Do you find yourself utilizing Ansible in pipelines or collaborating across teams? If so, tracking changes and keeping tabs on your last runs might be a priority. Enter ARA, a powerful tool that records Ansible activities and provides a comprehensive overview. In this article, we’ll delve into ARA, exploring how this tool can elevate your Ansible experience.
Ansible Overview
Ansible stands as an open-source automation software designed for tasks ranging from small-scale use cases to managing entire cloud ecosystems. Using minimal YAML configurations, you can automate processes such as package installations, network configurations, or even Kubernetes deployments on platforms like AWS.
ARA — ARA Records Ansible
ARA steps in as an Ansible reporting solution, capturing ansible and ansible-playbook commands regardless of their execution location or method. Achieving this functionality involves integrating a simple callback plugin into your existing content.
Reasons to Use ARA
Let’s take a closer look at ARA and understand its potential benefits. The first question that may arise is, “Why should I use ARA?” While ARA isn’t mandatory for running Ansible or enhancing playbook performance, it provides transparency into the execution process. ARA proves invaluable for:
- Compliance Audits
- Change Management
- CI/CD Tracking (e.g., GitOps)
- Self-Service Portal Use Cases
- Troubleshooting and Diagnosing
While not essential, ARA proves immensely helpful in various scenarios, offering a detailed insight into the execution timeline, failures, and changes made.
Installing the ARA Server
For those accustomed to running most services in containers, ARA follows suit. The initial setup involves spinning up an ARA container for testing purposes, as Playbooknstrated below:
- With Podman
``bash
$ podman run --name api-server --detach --tty \
--volume ara:/opt/ara:z -p 8000:8000 \
docker.io/recordsansible/ara-api:latest
`
- With Docker
`bash
docker run --name api-server --detach --tty \
--volume ara:/opt/ara:z -p 8000:8000 \
docker.io/recordsansible/ara-api:latest
`
This setup is suitable for testing; for production environments, proper authentication and other configurations should be considered.
Running Playbooks
Now that ARA is up and running, let’s explore how it works. ARA functions by requiring a playbook or any Ansible command to make a callback to the ARA API server. Configuration involves setting up Ansible on the control node to use the ARA callback plugin.
Creating a project directory and installing Ansible in a Python virtual environment can be achieved with the following commands:
``bash
Create project directory
$ mkdir myProject
Change into it
$ cd myProject/
Create a Python virtualenv
$ python -m venv .venv
Activate the new virtualenv
$ source .venv/bin/activate