# Force color output?

**URL:** <https://forum.ansible.com/t/force-color-output/16250>\
**Category:** Ansible Project\
**Created:** [September 16, 2014, 9:29pm UTC](https://forum.ansible.com/t/force-color-output/16250 "2014-09-16T21:29:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Harris](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@Jason\_Harris](https://forum.ansible.com/u/Jason_Harris)\
**Post date:** [September 16, 2014, 9:29pm UTC](https://forum.ansible.com/t/force-color-output/16250/1 "2014-09-16T21:29:13Z")

</div>

Hi All,

I am trying to capture ansible output with a python subprocess command. If I capture:

childProcess = subprocess.Popen(“ansible-playbook …”, shell=True, subprocess.PIPE, subprocess.PIPE, cwd=dir)

res = childProcess.communicate()

Then res[0] will be the stdout of my ansible command, and res[1] will be the stderr of my ansible command, but both will be uncoloured…

Is there an easy way to force ansible to always issue colour output independent of the term type it is detecting?

Thanks,  
Jason

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [September 16, 2014, 10:01pm UTC](https://forum.ansible.com/t/force-color-output/16250/2 "2014-09-16T22:01:38Z")

</div>

I actually just submitted a pull request to document the configuration to allow this earlier today.

It looks like it was merged as well.

Here is the commit containing the docs:

[https://github.com/sivel/ansible/commit/c319df78f87d92b1ba8a309d8318436a2454db08](https://github.com/sivel/ansible/commit/c319df78f87d92b1ba8a309d8318436a2454db08)

In short, in ansible.cfg under [defaults] set force\_color = 1

---

<div class="post-metadata">

**Author:** ![Jason\_Harris](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@Jason\_Harris](https://forum.ansible.com/u/Jason_Harris)\
**Post date:** [September 17, 2014, 8:28am UTC](https://forum.ansible.com/t/force-color-output/16250/3 "2014-09-17T08:28:26Z")

</div>

Thanks. This was just what I was after!

Thanks,  
Jason
