Skip to content

octplane/ansible_stdout_compact_logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

846fd30 · Mar 9, 2023

History

86 Commits
Mar 9, 2023
Jun 14, 2020
Jun 14, 2020
Mar 5, 2023
Mar 7, 2023
Jun 14, 2020
Dec 29, 2016
Nov 30, 2022
Mar 7, 2023
Mar 5, 2023
Mar 14, 2018
Mar 7, 2023
Mar 7, 2023
Mar 5, 2023
Mar 5, 2023
Mar 5, 2023
Sep 1, 2020
Jan 6, 2017
Jan 23, 2017
Jan 11, 2017
Jan 29, 2020
Mar 5, 2023

Repository files navigation

Ansible Stdout Compact Logger

Installation

  • put somewhere on your disk
  • add callback_plugins settings in your [defaults] settings in your ansible configuration
  • change stdout_callback to anstomlog

cf ansible.cfg.

Features

  • one-line display
  • pylint compatible (almost...)
  • displays tasks content in a nice way
  • including UTF-8 strings
  • indents structs, displays empty arrays, strings
  • puts fields on top when available ['stdout', 'rc', 'stderr', 'start', 'end', 'msg']
  • removes some fields when present [, 'stdout_lines', '_ansible_verbose_always', '_ansible_verbose_override'] to avoid too much clutter
  • reverts to standard logger when more than vv verbosity
  • supports no_log attribute in Task
  • supports _ansible_verbose_always and _ansible_verbose_override
  • supports multiple items in task (#1)
  • multi host support
  • correct duration computation
  • Display duration in minutes when tasks last for more than 1 minute
  • diff display support
  • displays stdout and stderr nicely even when they contain \n
  • displays handlers calls
  • Python 2/3 compatible
  • better line colouring
  • more test around curious errors

Without anstomlog

Stdout Display without anstomlog

With anstomlog

Stdout Display with multiline outputs

Test the logger

  • clone this repository
ansible-playbook test-1.yml
  • to run the tests, call python callbacks/anstomlog.py

License

MIT, see LICENSE file.

Tips and tricks

  • Issue with non-ascii or utf-8 chars? Have a look at #4

Contributors

  • Pierre BAILLET @octplane
  • Frédéric COMBES @marthym
  • @tterranigma
  • @OurFriendIrony
  • Farzad FARID @farzy
  • Jérôme BAROTIN @jbarotin
  • Dale Henries @dalehenries
  • Thomas Decaux @ebuildy