diff options
author | akire0ne <80416563+akire0ne@users.noreply.github.com> | 2024-08-09 16:26:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-09 16:26:21 +0200 |
commit | 7b74de069cfeb5f1ec1b9f3d1784e1c744d93488 (patch) | |
tree | e29b30dc8dd4b00ec758c2de79f9496948dd968a | |
parent | use diff intermediate var to preserve functionality (#83738) (diff) | |
download | ansible-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>
-rw-r--r-- | changelogs/fragments/colors_for_included_events.yml | 4 | ||||
-rw-r--r-- | lib/ansible/config/base.yml | 8 | ||||
-rw-r--r-- | lib/ansible/plugins/callback/default.py | 2 | ||||
-rw-r--r-- | lib/ansible/utils/display.py | 1 |
4 files changed, 14 insertions, 1 deletions
diff --git a/changelogs/fragments/colors_for_included_events.yml b/changelogs/fragments/colors_for_included_events.yml new file mode 100644 index 0000000000..0ff029717c --- /dev/null +++ b/changelogs/fragments/colors_for_included_events.yml @@ -0,0 +1,4 @@ +bugfixes: + - COLOR_SKIP will not alter "included" events color display anymore. +minor_changes: + - Introducing COLOR_INCLUDED parameter. This can set a specific color for "included" events. 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, |