Ansible debug module wont show colorful output like shell echo

My shell script echoes status in colorful texts. I used register variable to store the output. Used debug module to output it. But instead of colorful texts all it does is append like :

“stdout_lines”: [ “\u001b[31mRed text \u001b[47mand white background\u001b(B\u001b[0m” ]

I actually want it to be Red text and white background

My sample playbook looks like this:

  • name: output shell scripts with color

shell: ‘echo “$(tput setaf 1)Red text $(tput setab 7)and white background$(tput sgr 0)”’

register: echo_output

  • debug: var=echo_output

Any help appreciated!

(attachments)

Screenshot 2019.png