ARA Records Ansible for Ansible Reporting
Enhancing Ansible Workflows with ARA for Ansible Reporting
Original post: https://blog.while-true-do.io/spotlight-ara-records-ansible/
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 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 demonstrated below:
- With Podman
$ podman run --name api-server --detach --tty \
--volume ara:/opt/ara:z -p 8000:8000 \
- With Docker
docker run --name api-server --detach --tty \
--volume ara:/opt/ara:z -p 8000:8000 \
This setup is suitable for testing; for production environments, proper authentication and other configurations should be considered.
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:
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
Install Ansible and ARA plugins
$ pip install ansible ara
Subsequently, Ansible needs to be configured using the ARA callback plugin. This involves creating an Ansible configuration file (ansible.cfg) with the appropriate plugin paths.
# Find the callback plugin path
$ python3 -m ara.setup.ansible
# Create the config file
$ touch ansible.cfg
The content of the
ansible.cfg file includes the plugin paths and additional configurations:
api_client = http
api_server = http://localhost:8000
Running Playbooks and Viewing Results With the setup complete, executing a playbook involves the following steps:
Create a playbook (e.g., playbook.yml). Run the playbook:
$ ansible-playbook -K -k -i inventory, playbook.yml
- View results in ARA by accessing the web interface at
ARA offers a powerful solution for recording Ansible activities, providing transparency and detailed insights into playbook execution. Whether for compliance audits, change management, or CI/CD tracking, ARA proves to be a valuable addition to your Ansible toolkit. For small-scale or local development scenarios, ARA can be run without a dedicated server. As you explore ARA further, consider delving into topics such as API security, alternative databases, server administration, and integration with CI/CD pipelines. For those considering ARA for production use, explore the following topics: API Security, Using a Database Other Than SQLite, and Server Administration. Additionally, consider integrating ARA into your CI/CD pipeline with the ARA API client and explore features like names and labels. To learn more about ARA and get started, refer to the official documentation: [ARA Documentation[(https://docs.ansible.com/ansible/latest/collections/community/general/ara.html). Happy automating with Ansible and ARA!Subscribe to the YouTube channel, Medium, and Website, X (formerly Twitter) to not miss the next episode of the Ansible Pilot.
Learn the Ansible automation technology with some real-life examples in my
My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps
Want to keep this project going? Please donate