Hello,
For over a year, I’ve been working on and off on a pipeline for exporting all sorts of playbook statistics to Azure Log Analytics and then to Grafana. It has been extremely useful in getting a better view of all my Ansible operations.
It works kinda like this:
tasks:
- block:
[ do the thing ]
always:
- include_role:
name: export_playbook_stats
I even wrote a callback plugin to export the task timers to localhost so that they too can be exported as a log.
self.vars_manager.set_host_variable("localhost", 'task_timers', [v for _, v in self.stats.items()])
I have a dashboard that shows all sorts of stats about a play, such as which hosts fail most often, but something is missing: The error message associated with that host.
Adding register
to every task is unfeasible. Even more so because a host gets kicked out once if fails the play.
Those error messages are written somewhere, does anyone know where they are and how I can bring them up to the surface of the play so that I may export them?
Thanks,