# Run ansible-playbook within AAP EE, without color output

**URL:** <https://forum.ansible.com/t/run-ansible-playbook-within-aap-ee-without-color-output/7793>\
**Category:** Get Help\
**Tags:** aap, awx, ee\
**Created:** [August 12, 2024, 10:22am UTC](https://forum.ansible.com/t/run-ansible-playbook-within-aap-ee-without-color-output/7793 "2024-08-12T10:22:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrO](https://avatars.discourse-cdn.com/v4/letter/c/ce73a5/32.png) [@ChrO](https://forum.ansible.com/u/ChrO)\
**Post date:** [August 12, 2024, 10:22am UTC](https://forum.ansible.com/t/run-ansible-playbook-within-aap-ee-without-color-output/7793/1 "2024-08-12T10:22:01Z")

</div>

We have to run an Ansible playbook of a third party vendor within an AAP execution environment.

This playbook needs a custom inventory, which we cannot register as an AAP inventory. So we run “ansible-playbook --inventory /custom/inventory /path/to/3rdparty.yml” either using ansible.builtin.shell or ansible.builtin.command from a wrapper playbook.

The execution itself works fine and gives us the expected result. The biggest problem we have so far is output capturing and output formatting of the ansible-playbook command: We cannot manage to get rid of the escape sequences which are used by ansible-playbook for coloring the output. This makes the Job output unreadable in AAP.

What I tried so far:

1. put a custom ansible.cfg into the project and set nocolor=True
  - Debug output shows, that the ansible.cfg file is used, but the nocolor setting is not honoured → ansible-playbook still produces colorized output
  - trying it out in an interactive session of the EE container, it works fine

2. add ANSIBLE\_NOCOLOR and NO\_COLOR environment vars to the ansible.builtin.shell parameters.
  - these do not seem to be honoured either → still colorized output

3. all kind of weird stuff you can find on other forums
  - pipe the output of ansible-playbook through cat etc. → still colorized output

4. put the ansible-playbook call into an extra shell script, setting the environment vars there and run this shell script via ansible.builtin.shell
  - no change to the situation

Is there any other way I can run a custom playbook from a wrapper playbook on AAP without the color escape sequences added to the output?

AAP version as far as I can see is 4.4.4  
Ansible version in the EE is 2.15.11

Thanks for any hint.  
Cheers,  
Chris

---

<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:** [August 12, 2024, 2:25pm UTC](https://forum.ansible.com/t/run-ansible-playbook-within-aap-ee-without-color-output/7793/2 "2024-08-12T14:25:40Z")

</div>

That indicates that `ANSIBLE_FORCE_COLOR` is also set somehow, try also adding `ANSIBLE_FORCE_COLOR: "0"` alongside `ANSIBLE_NOCOLOR` and `NO_COLOR` to see if that changes anything.

---

<div class="post-metadata">

**Author:** ![ChrO](https://avatars.discourse-cdn.com/v4/letter/c/ce73a5/32.png) [@ChrO](https://forum.ansible.com/u/ChrO)\
**Post date:** [August 12, 2024, 4:42pm UTC](https://forum.ansible.com/t/run-ansible-playbook-within-aap-ee-without-color-output/7793/3 "2024-08-12T16:42:40Z")

</div>

Hey Sivel,

seems I relied on the documented default value for ANSIBLE\_FORCE\_COLOR being “False”, and only once forced it to “False” at the very beginning of my journey, but obviously not in the right combination with the other _COLOR_ environment vars.  
When checking the actual environment, I just saw that it is set to True, although there is no obvious ansible.cfg anywhere in my EE.

This seems to remove the color specific ESC sequences from the output. The task headers and the Recap look clean now.

Now there are still a lot of lines with this pattern in the output:

```auto
"\u001b[Ke30=\u001b[4D\u001b[K\u001b[KeyJ1XYZXYZDUMMYDUMMYXYZXYZJ9\u001b[64D\u001b[K",

```

This could be solved thanks to your hints in this thread: [Garbled output from nested playbooks · Issue #1317 · ansible/ansible-runner · GitHub](https://github.com/ansible/ansible-runner/issues/1317)

Thanks a lot.  
Cheers,  
Chris
