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

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!

Have you tried setting the ANSIBLE_FORCE_COLOR=true variable ?

1 Like

No. Is that an environment variable?

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

Awesome! It worked. Thanks! :slight_smile: