summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorakire0ne <80416563+akire0ne@users.noreply.github.com>2024-08-09 16:26:21 +0200
committerGitHub <noreply@github.com>2024-08-09 16:26:21 +0200
commit7b74de069cfeb5f1ec1b9f3d1784e1c744d93488 (patch)
treee29b30dc8dd4b00ec758c2de79f9496948dd968a /lib
parentuse diff intermediate var to preserve functionality (#83738) (diff)
downloadansible-7b74de069cfeb5f1ec1b9f3d1784e1c744d93488.tar.xz
ansible-7b74de069cfeb5f1ec1b9f3d1784e1c744d93488.zip
fix: `COLOR_INCLUDED` to colorize `included` output (#83711)
adds color included configuration and applies to include message Co-authored-by: Achille Myette <amyette@drw.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/ansible/config/base.yml8
-rw-r--r--lib/ansible/plugins/callback/default.py2
-rw-r--r--lib/ansible/utils/display.py1
3 files changed, 10 insertions, 1 deletions
diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml
index 6fabaee081..a6435cc716 100644
--- a/lib/ansible/config/base.yml
+++ b/lib/ansible/config/base.yml
@@ -304,6 +304,14 @@ COLOR_HIGHLIGHT:
env: [{name: ANSIBLE_COLOR_HIGHLIGHT}]
ini:
- {key: highlight, section: colors}
+COLOR_INCLUDED:
+ name: Color for 'included' task status
+ default: cyan
+ description: Defines the color to use when showing 'Included' task status.
+ env: [{name: ANSIBLE_COLOR_INCLUDED}]
+ ini:
+ - {key: included, section: colors}
+ version_added: '2.18'
COLOR_OK:
name: Color for 'ok' task status
default: green
diff --git a/lib/ansible/plugins/callback/default.py b/lib/ansible/plugins/callback/default.py
index c96d9ababc..4a0bf0d05b 100644
--- a/lib/ansible/plugins/callback/default.py
+++ b/lib/ansible/plugins/callback/default.py
@@ -293,7 +293,7 @@ class CallbackModule(CallbackBase):
label = self._get_item_label(included_file._vars)
if label:
msg += " => (item=%s)" % label
- self._display.display(msg, color=C.COLOR_SKIP)
+ self._display.display(msg, color=C.COLOR_INCLUDED)
def v2_playbook_on_stats(self, stats):
self._display.banner("PLAY RECAP")
diff --git a/lib/ansible/utils/display.py b/lib/ansible/utils/display.py
index 2379aecf6d..e514155e16 100644
--- a/lib/ansible/utils/display.py
+++ b/lib/ansible/utils/display.py
@@ -172,6 +172,7 @@ if getattr(C, 'DEFAULT_LOG_PATH'):
color_to_log_level = {C.COLOR_DEBUG: logging.DEBUG,
C.COLOR_VERBOSE: logging.INFO,
C.COLOR_OK: logging.INFO,
+ C.COLOR_INCLUDED: logging.INFO,
C.COLOR_CHANGED: logging.INFO,
C.COLOR_SKIP: logging.WARNING,
C.COLOR_DEPRECATE: logging.WARNING,