Simplifying Ansible Output with the community.general.unixy Callback Plugin
Streamlining Ansible Output for Improved Readability for Unix processes.
Introduction
Ansible is a powerful open-source automation tool that simplifies configuration management, application deployment, and task automation. When running Ansible playbooks, the default output can sometimes be overwhelming, especially when dealing with a large number of hosts and tasks. The community.general.unixy
callback plugin offers a condensed and readable format for Ansible output, resembling the familiar style of LINUX/UNIX startup logs.
Understanding Callback Plugins
Callback plugins in Ansible allow you to customize and enhance the output generated during playbook execution. The community.general.unixy
callback plugin is a stdout callback, meaning it alters the standard output format of Ansible when running playbooks.
Configuration Setup
To enable the community.general.unixy
callback plugin, you need to make a few configurations in your Ansible setup. In the ansible.cfg
file, add the following lines under the [defaults]
section:
[defaults]
callbacks_enabled = community.general.unixy
stdout_callback = community.general.unixy
This ensures that the community.general.unixy
callback plugin is activated and set as the stdout callback.
Example Playbook
Let’s consider a simple Ansible playbook named ping.yml
that utilizes the ansible.builtin.ping
module to test the connection to all hosts:
---
- name: Ping module demo
hosts: all
tasks:
- name: Test connection
ansible.builtin.ping:
In the provided inventory file (inventory
), the connection is set to local:
localhost ansible_connection=local
Running Playbooks Without and With Unixy Callback
The Best Resources For Ansible
Certifications
- Coursera Pro - Unlimited access to 7,000+ world-class courses, hands-on projects, and job-ready certificate programs—all included in your subscription
Video Course
Printed Book
-
Ansible For VMware by Examples
-
Ansible for Kubernetes by Example
-
Hands-on Ansible Automation
-
Red Hat Ansible Automation Platform
eBooks
- Ansible by Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps
- Ansible Cookbook: A Comprehensive Guide to Unleashing the Power of Ansible via Best Practices, Troubleshooting, and Linting Rules with Luca Berton
- Terraform By Example: A Practical Approach for Beginners to Learn Cloud Infrastructure with Terraform
- Ansible For Windows By Examples: 50+ Automation Examples For Windows System Administrator And DevOps
- Ansible For Linux by Examples: 100+ Automation Examples For Linux System Administrator and DevOps
- Ansible Linux Filesystem By Examples: 40+ Automation Examples on Linux File and Directory Operation for Modern IT Infrastructure
- Ansible For Security by Examples: 100+ Automation Examples to Automate Security and Verify Compliance for IT Modern Infrastructure
- Ansible Tips and Tricks: 10+ Ansible Examples to Save Time and Automate More Tasks
- Ansible Linux Users & Groups By Examples: 20+ Automation Examples on Linux Users and Groups Operation for Modern IT Infrastructure
- Ansible For PostgreSQL by Examples: 10+ Examples To Automate Your PostgreSQL database
- Ansible For Amazon Web Services AWS By Examples: 10+ Examples To Automate Your AWS Modern Infrastructure
- Ansible Automation Platform By Example: A step-by-step guide for the most common user scenarios
Without Unixy:
ansible-playbook -i inventory ping.yml
The default output might look like this:
PLAY [Ping module demo] *****************************************************************
TASK [Gathering Facts] ******************************************************************
[WARNING]: Platform darwin on host localhost is using the discovered Python interpreter
at /opt/homebrew/bin/python3.12, but future installation of another Python interpreter
could change the meaning of that path. See https://docs.ansible.com/ansible-
core/2.16/reference_appendices/interpreter_discovery.html for more information.
ok: [localhost]
TASK [Test connection] ******************************************************************
ok: [localhost]
PLAY RECAP ******************************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
With Unixy:
ansible-playbook -i inventory ping.yml
Enabling the Unixy callback plugin results in a more concise and readable output:
Executing playbook ping.yml
- Ping module demo on hosts: all -
Gathering Facts...
[WARNING]: Platform darwin on host localhost is using the discovered Python interpreter
at /opt/homebrew/bin/python3.12, but future installation of another Python interpreter
could change the meaning of that path. See https://docs.ansible.com/ansible-
core/2.16/reference_appendices/interpreter_discovery.html for more information.
localhost ok
Test connection...
localhost ok
- Play recap -
localhost : ok=2 changed=0 unreachable=0 failed=0 rescued=0 ignored=0
Conclusion
The community.general.unixy
callback plugin provides a streamlined Ansible output, making it easier to interpret and understand the status of your playbooks. By incorporating this plugin into your Ansible configuration, you can enhance the overall readability of your automation tasks, especially in scenarios with numerous hosts and complex playbooks.
Academy
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
Donate
Want to keep this project going? Please donate