When running molecule the logs display with colors:
molecule lint -s preprod
--> [36mValidating schema /home/singuliere/software/enough/infrastructure/molecule/letsencrypt-nginx/molecule.yml.[0m
[0m[0m[0m[32mValidation completed successfully.[0m [0m[0m[0m--> [36mValidating schema /home/singuliere/software/enough/infrastructure/molecule/postfix/molecule.yml.[0m ...
which can be disabled by piping the output to cat
(it only shows when the output is a tty)
molecule lint -s preprod | cat
--> Validating schema /home/singuliere/software/enough/infrastructure/molecule/letsencrypt-nginx/molecule.yml. Validation completed successfully. ...
Is there a permanent way to do the same? I tried setting ANSIBLE_NOCOLOR=true in the environment but it does not have the desired effect.
It seems that this behaviour is hardcoded.
You can patch molecule's logger class to disable colours.
Find module's path with python -c 'import molecule; print(molecule.__file__)'
.
Modify logger.py
in that folder:
def color_text(color, msg):
return msg
# return '{}{}{}'.format(color, msg, colorama.Style.RESET_ALL)