output xterm

Hi,

xterm -cm

ansible-playbook basis.yml

PLAY [aaagerrit-on-1-mgt] *********************

GATHERING FACTS *********************
ok: [aaagerrit-on-1-mgt]

TASK: [Configureer apt.conf] *********************
ok: [aaagerrit-on-1-mgt]

TASK: [Installeer package at (crontab)] *********************
ok: [aaagerrit-on-1-mgt]

TASK: [Installeer package di (advanced df like disk information utility)] *********************
ok: [aaagerrit-on-1-mgt]

TASK: [Installeer package locate (maintain and query an index of a directory tree)] *********************
ok: [aaagerrit-on-1-mgt]

TASK: [Installeer package lshw] *********************
ok: [aaagerrit-on-1-mgt]

TASK: [Installeer package lsof] *********************
ok: [aaagerrit-on-1-mgt]

TASK: [Installeer package man (man pages)] *********************
ok: [aaagerrit-on-1-mgt]

TASK: [Installeer package open-vm-tools (vmware)] *********************
ok: [aaagerrit-on-1-mgt]

TASK: [Installeer package sysstat (system performance tools)] *********************
ok: [aaagerrit-on-1-mgt]

TASK: [Installeer package telnet] *********************
ok: [aaagerrit-on-1-mgt]

TASK: [Installeer package vim] *********************
ok: [aaagerrit-on-1-mgt]

TASK: [Voeg ssh key Gerrit toe] *********************
ok: [aaagerrit-on-1-mgt]

TASK: [Voeg ssh key Guy toe] *********************
ok: [aaagerrit-on-1-mgt]

PLAY RECAP *********************
aaagerrit-on-1-mgt : ok=14 changed=1 unreachable=0 failed=0

I started a xterm with the -cm option, this means no color output. Now, it’s not possible to see which TASK was changed. It works great when the console support color. Then, you can see which TASK was changed. But, we have a system admin who is color blind. Hard for him.

  • Is it possible to diable the color? It’s also very hard to read blue output on a background who is black?

  • Maybe change, the output:

TASK: [Voeg ssh key Guy toe] *********************
ok: [aaagerrit-on-1-mgt]

to

TASK: [Voeg ssh key Guy toe] *********************
ok: (changed) [aaagerrit-on-1-mgt]

Regards,
Gerrit

- Is it possible to diable the color? It's also very hard to read blue
output on a background who is black?

$ export ANSIBLE_NOCOLOR=yes # or "no" or "1" or "hello.world" :wink:
$ ansible-playbook ...

        -JP

Colors can be disabled by using a terminal without colors (e.g. xterm-m).
Ansible should query terminal capabilities for deciding whether to use colors IMO.

The way I do this is in python is by using: curses.tigetnum('colors')
Maybe there is a more efficient way to check ?

Michael, would a patch for testing terminal color capabilities be accepted ?

absolutely.

The way I do this is in python is by using: curses.tigetnum('colors')

Indeed, and I originally wanted to use "standard" methods to do so.
Unfortunately, curses.tigetnum() requires a .setupterm() first, and that
starts getting messy when things go wrong and Curses can't .endwin().

That, and the fact that I'm not sure whether Curses exists per default
in Python, drove me to use simple and unportable (!) escape sequences.

My next step was trying to find a native Python way of querying
Termcap/Terminfo directly (thus avoiding the Curses overhead), but I
failed on that account as well. :frowning:

I'd be delighted if you can fix all that w/o requiring additional
modules...

        -JP