Looking to add color to your Ansible console output? This is one way to do it

Add force_color = True to your Defaults section in /etc/foreman-proxy/ansible.cfg like this:

...
[defaults]
callback_whitelist = foreman, timer, profile_tasks, profile_roles, changes
diff_always = True
force_color = True
host_key_checking = False
local_tmp = /etc/ansible/tmp
retry_files_enabled = False
stdout_callback = yaml
vault_password_file = ~/.ansible_vault_password
...

This options forces color mode even when running without a TTY or the “nocolor” setting is True.

Source: https://docs.ansible.com/ansible/latest/reference_appendices/config.html#ansible-configuration-settings-locations

5 Likes