/ansbak

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

ansbak

ansbak coalesces ansible -m shell output. If two machines return identical output, you only see it once. This is similar to dshbak for pdsh or clush --dshbak from clustershell.

Without ansbak:

$ ansible host1:host2 -m shell -a 'echo foo\\nbar'
host1 | success | rc=0 >>
foo
bar

host2 | success | rc=0 >>
foo
bar

With ansbak:

$ ansible host1:host2 -m shell -a 'echo foo\\nbar'  | ansbak.py
host1,host2 | success | rc=0 >>
foo
bar

To allow ansible to colour code, you can force it with the following, which ansbak can still parse:

$ export ANSIBLE_FORCE_COLOR=true
$ ansible host1:host2 -m shell -a 'echo foo\\nbar'  | ansbak.py
host1,host2 | success | rc=0 >>
foo
bar

Tests

To run tests:

$ pytest

Todo

  • Group hostnames more intelligently, e.g., "host1-3" instead of "host1, host2, host3"