Analyzing Ansible Playbooks Using ARA
Tags: #Ansible #ARA
Introduction To ARA
ARA is an open-source tool that can log your Ansible playbook runs, save them into a database, and display them in an intuitive web interface.
It integrates with Ansible using Ansible callback plugin to log your playbook run.
ARA can be deployed anywhere and record Ansible playbook runs from multiple sources.
ARA As Part Of Your Stack
ARA is production tested and is a big part of the OpenStack upstream CI initiative.
One of the downsides of Ansible is that all of your Ansible executions are only logged to output. There is no native way to keep a record of an Ansible run.
Ansible Tower or its upstream project AWX is a different product that leverages Ansible and enhances it with many additional capabilities (like recording executions).
Compared to Ansible Tower, ARA aims to solve a single issue, provide an interface to log and view Ansible playbook runs, and doesn’t require any additional complex deployments or maintenance.
ARA is a Python tool hosted on PyPI.
For a more in-depth guide on installing ARA, refer to its documentation.
Install ARA via pip(make sure Ansible is installed):
pip install ara
Configure Ansible To Use Ara
ARA integrates with Ansible using callback plugins, which can be defined via configuration file (
ansible.cfg) or via environment variables.
Retrieve the needed environment variables:
# View environment variables
python -m ara.setup.env
# Source environment variables
eval $(python -m ara.setup.env)
Once a callback plugin is used, ARA also provides additional Ansible modules which enhance its capabilities.
Start The ARA Standalone Server
Note: By default, the ARA web interface will be started on 127.0.0.1 due to the ARA_HOST environment variable's default. To change the bind, assign a new value to ARA_HOST.
A web interface is a part of ARA, and it can be launched using the
ara-manage runserver &
Browse the server at
Run A Demo Playbook
Create the following demo
- hosts: localhost
- name: Print Message
msg: "This is a demo for ARA"
- name: Log ARA Key
Exploring ARA Records
After each Ansible playbook run, the record is saved into a database.
We’ll focus on the web interface. CLI exploration is out of scope and can be viewed in ARA’s documentation.
A web interface representing all the records is available:
You can view the playbook’s content by clicking its name:
Viewing Ansible Variables
All Ansible variables are logged and can be viewed by clicking on
Viewing Ansible Hosts
All Ansible hosts that were used in the run can be viewed by clicking on
View Ansible Plays
All Ansible plays that were performed in the run can be viewed by clicking
View Ansible Playbook Files
All the files that are part of the playbook can be viewed by clicking
View Ansible Tasks
All tasks which were performed in the run can be viewed by clicking
The result of an individual task can be viewed by clicking on its entry in the
View ARA Records
ARA records are special variables that can be registered and accessed during the run. Those records are logged and displayed as part of an Ansible run record.
ARA is an excellent addition to your Ansible flow, and it’s easy to set up, scalable, and decentralized.
A small self-hosted ARA enhances the troubleshooting and logging capabilities of Ansible.