如何控制Ansible消息的颜色(前景和背景)?

时间:2019-01-31 21:20:07

标签: colors ansible

关于https://docs.ansible.com/ansible/latest/modules/debug_module.html,没有提到如何控制文本的前景色和背景色。有可能控制吗?

1 个答案:

答案 0 :(得分:2)

可以在配置文件和/或环境变量中configure种颜色。

例如debug

> cat ansible.cfg
[defaults]
inventory = $PWD/hosts
...
[colors]
debug = red
deprecate = bright purple
changed = purple

> set | grep ANSIBLE_COLOR_DEBUG
ANSIBLE_COLOR_DEBUG=red