@jp_mens pushed some very nice additions this morning to colorize parts of playbooks. Failure counts in red, success in green, changes in yellow.
I've taken this a bit further and applied this to the rest of ansible playbook output. Job status messages for async show up in blue.
Let me know if you have any issues with the tty detection NOT working or anything else, and if you really don't like it, set ANSIBLE_NOCOLOR=1
As with past releases, it works especially well if cowsay is installed.
--Michael
Got this from a fresh git clone:
TASK: [Create /etc/services] *********************
fatal: [bcomdhcp5029] => Traceback (most recent call last):
File "/usr/local/ansible/lib/ansible/runner/__init__.py", line 445,
in _executor
exec_rc = self._executor_internal(host)
File "/usr/local/ansible/lib/ansible/runner/__init__.py", line 485,
in _executor_internal
return self._executor_internal_inner(host, inject, port)
File "/usr/local/ansible/lib/ansible/runner/__init__.py", line 600,
in _executor_internal_inner
self.callbacks.on_failed(result.host, data)
File "/usr/local/ansible/lib/ansible/callbacks.py", line 271, in
on_failed
return color.string(msg, 'red')
NameError: global name 'color' is not defined
$ env | grep -i ansible
ANSIBLE_NOCOLOR=1
ANSIBLE_LIBRARY=/usr/local/ansible/library
PATH=/usr/local/ansible/bin:/usr/bin:/bin
PYTHONPATH=/usr/local/ansible/lib
I’ve made some updates to change ‘black’ to the default color, as well as change the darker blue to cyan, so if you were using a black terminal and secretly cursing my name, it looks pretty decent now, and you might like it. Not entirely happy with yellow-on-white
Apologies to Kenny Wayne Shepherd for the commit message:
https://github.com/ansible/ansible/commit/e035ce97ce893fab9a1b8ccb37fc2e2b80c406b8
Could probably change the red to “bright red” if that would make it easier to see.