Skip to content

linuxfabrik.lfops.compact (callback)

Compact output, one block per task, ok and skipped hosts summarized

Synopsis

  • Prints one block per task, with the role and the task name on lines of their own.
  • While the task runs, every host result appends an asterisk in the color of its status (ok, changed, skipped, failed, unreachable), so the asterisks add up to a progress bar.
  • After the task, unchanged ok and skipped hosts are listed in one ok and one skipped line. Host names that share the part up to the last dash and the delegation target are merged in bash brace expansion syntax, for example web-{01,02} > localhost.
  • While a task runs, only the progress bar and failures are printed. At its end, the changed hosts follow, grouped by identical output (the diff, or without a diff the msg, results, stdout and stderr of the result, where modules report what they changed), then the output of ansible.builtin.debug tasks (see display_debug_output), then the ok and skipped hosts, then the warnings.
  • Failed and unreachable results are printed as usual, with msg, stdout, stderr, module_stdout and module_stderr as plain text below the JSON, so tracebacks stay readable.
  • Warnings are grouped by text and list the hosts they occurred on. A host name within a warning of Ansible itself (for example from a lookup) is replaced by <host> for the grouping.
  • Failures that a task accepts with ignore_errors are shown in one ignored line per message with the hosts, not as a full result (--verbose shows the full result).
  • At the end of the run, a report in Markdown lists each distinct message once with the hosts it occurred on, in sections by severity (FATAL, UNREACHABLE, WARNING, IGNORED, CHANGED), within a section one list per role (or playbook) with the task names in task order.

Available since LFOps 10.0.0.

Requirements

  • set as stdout callback in the configuration

Optional Parameters

display_debug_output

  • Show the output of ansible.builtin.debug tasks, although their hosts are ok, grouped by identical output like the changes. If disabled, the hosts of a ansible.builtin.debug task are listed in the ok line like those of any other task.
  • Type: Bool.
  • Default: true

Examples

# ansible.cfg
[defaults]
stdout_callback = linuxfabrik.lfops.compact

# ansible-navigator.yml
ansible-navigator:
  execution-environment:
    environment-variables:
      set:
        ANSIBLE_STDOUT_CALLBACK: 'linuxfabrik.lfops.compact'

Notes

  • Under ansible-navigator, set the environment variable ANSIBLE_STDOUT_CALLBACK. ansible-runner replaces the stdout callback with its own wrapper, which only builds on this variable and ignores stdout_callback in ansible.cfg. The terminal needs at least 65 columns there, since ansible-runner writes 64 characters wide invisible event markers, which wrap and become visible on a narrower terminal, with any stdout callback.
  • Made for the linear strategies (linear, mitogen_linear), which run one task on all hosts before the next. With free or host_pinned, the progress bar and the host lists of concurrent tasks mix.

Authors

  • Linuxfabrik GmbH, Zurich, Switzerland, https://www.linuxfabrik.ch