Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upinclude_tasks + loop: no "=> (item=…)" output #65904
Open
Labels
Comments
This comment has been minimized.
This comment has been minimized.
|
Files identified in the description: If these files are inaccurate, please update the |
This comment has been minimized.
This comment has been minimized.
|
I believe the following is all that is required to get this working: diff --git a/lib/ansible/plugins/callback/default.py b/lib/ansible/plugins/callback/default.py
index c68010959d..8147cb6aa2 100644
--- a/lib/ansible/plugins/callback/default.py
+++ b/lib/ansible/plugins/callback/default.py
@@ -350,8 +350,9 @@ class CallbackModule(CallbackBase):
def v2_playbook_on_include(self, included_file):
msg = 'included: %s for %s' % (included_file._filename, ", ".join([h.name for h in included_file._hosts]))
- if 'item' in included_file._args:
- msg += " => (item=%s)" % (self._get_item_label(included_file._args),)
+ label = self._get_item_label(included_file._vars)
+ if label:
+ msg += " => (item=%s)" % label
self._display.display(msg, color=C.COLOR_SKIP)
def v2_playbook_on_stats(self, stats):Feel free to put together a PR, including a changelog fragment as well. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I confirm the solution proposed by @sivel works. |
This comment has been minimized.
This comment has been minimized.
|
Aaand we have this ^^ PR. Sorry folks I almost forget it, Thanks for waiting! :-) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SUMMARY
Expected output:
Current output:
The problem is here:
ansible/lib/ansible/plugins/callback/default.py
Line 353 in ec0885c
'item'is inincluded_file._varsnotincluded_file._args.Also,
ansible_loop_varshould be used instead of 'item' (but I don't know how), so loop_control.loop_var could be used.ISSUE TYPE
COMPONENT NAME
ansible/lib/ansible/plugins/callback/default.py
Line 353 in ec0885c
lib/ansible/plugins/callback/default.py
v2_playbook_on_include
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Archlinux uptodate.
STEPS TO REPRODUCE
included.yml:
playbook.yml:
EXPECTED RESULTS
ACTUAL RESULTS