mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-11 02:25:36 +00:00
[PR #12113/ef5b22d1 backport][stable-12] unixy callback: fix KeyError when task is delegated to host without ansible_host set (#12142)
unixy callback: fix KeyError when task is delegated to host without ansible_host set (#12113)
* fixes issue #12112
* adjust PR ID
* adjust PR ID, mistake was made
* adjust PR ID
* I messed up all these numbers
---------
(cherry picked from commit ef5b22d18e)
Co-authored-by: Stefan Midjich <stemid@users.noreply.github.com>
Co-authored-by: Stefan Midjich <stefan@sydit.se>
This commit is contained in:
parent
eedba20600
commit
2e628f9895
2 changed files with 3 additions and 1 deletions
|
|
@ -74,7 +74,7 @@ class CallbackModule(CallbackModule_default):
|
|||
return task_result
|
||||
|
||||
if self.delegated_vars:
|
||||
task_delegate_host = self.delegated_vars["ansible_host"]
|
||||
task_delegate_host = self.delegated_vars.get("ansible_host") or result._task.delegate_to or ""
|
||||
task_result = f"{task_host} -> {task_delegate_host} {msg}"
|
||||
|
||||
if result._result.get("msg") and result._result.get("msg") != "All items completed":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue