Ansible shell command run by gitlab-runner is missing its color, can we fix that?


#1

I’m running Ansible playbooks via gitlab-ci schedules. Unfortunately, the output when viewing the job is missing the colors Ansible sets when run in a normal terminal.

Is there a way to tell GitLab-CI to use the colors Ansible sets?

Specifically, I really would like the failed tasks to be colored red. That makes troubleshooting a lot easier…

I believe this is the relevant code in Ansible: https://github.com/ansible/ansible/blob/devel/lib/ansible/utils/color.py

Thanks!


#2

Have you tried setting the ANSIBLE_FORCE_COLOR=true variable ?


#3

No. Is that an environment variable?


#4

Yup. See https://github.com/xens/ansiblefest2k17/blob/master/.gitlab-ci.yml.


#5

Awesome! It worked. Thanks! :slight_smile: