# output xterm

**URL:** <https://forum.ansible.com/t/output-xterm/11826>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [August 24, 2012, 12:37pm UTC](https://forum.ansible.com/t/output-xterm/11826 "2012-08-24T12:37:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yerrysherry](https://avatars.discourse-cdn.com/v4/letter/y/b5e925/32.png) [@yerrysherry](https://forum.ansible.com/u/yerrysherry)\
**Post date:** [August 24, 2012, 12:37pm UTC](https://forum.ansible.com/t/output-xterm/11826/1 "2012-08-24T12:37:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jpmens1](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@jpmens1](https://forum.ansible.com/u/jpmens1)\
**Post date:** [August 24, 2012, 12:56pm UTC](https://forum.ansible.com/t/output-xterm/11826/2 "2012-08-24T12:56:52Z")

</div>

> - 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" 😉  
$ ansible-playbook ...

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-JP

---

<div class="post-metadata">

**Author:** ![Dag\_Wieers](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@Dag\_Wieers](https://forum.ansible.com/u/Dag_Wieers)\
**Post date:** [August 24, 2012, 8:48pm UTC](https://forum.ansible.com/t/output-xterm/11826/3 "2012-08-24T20:48:01Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [August 24, 2012, 9:00pm UTC](https://forum.ansible.com/t/output-xterm/11826/4 "2012-08-24T21:00:47Z")

</div>

absolutely.

---

<div class="post-metadata">

**Author:** ![jpmens1](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@jpmens1](https://forum.ansible.com/u/jpmens1)\
**Post date:** [August 25, 2012, 8:40am UTC](https://forum.ansible.com/t/output-xterm/11826/5 "2012-08-25T08:40:25Z")

</div>

> 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. ☹

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

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-JP
