ansible-runner
ansible-runner copied to clipboard
Add hostvars mapping in awx_display callback
SUMMARY
Fixes: #1137
Signed-off-by: Abhijeet Kasurde [email protected]
ISSUE TYPE
- Bugfix Pull Request
COMPONENT NAME
ansible_runner/display_callback/callback/awx_display.py
cc @sivel
We should add some regression test coverage, but :+1: this looks good.
The encoder class is pretty self-aware that it duplicates the Ansible-core version, in its doc string:
The class AnsibleJSONEncoder exists in Ansible core for this function this performs a mostly identical function via duck typing
We should really fix this soon, so I want to formalize the suggestion. Is the idea to replace the AnsibleJSONEncoderLocal class inside of ansible_runner.display_callback.callback.awx_display with instead an import to this?
from ansible.module_utils.common.json import AnsibleJSONEncoder
Yeah, probably something along those lines, at least for this specific case, but especially once data tagging lands, we'll need to be much more specific about what metadata we actually want to preserve in the callback output.
I'm still uncertain about the value of e.g., preserving the internal representation of an inline vaulted var in callback output. Shouldn't we just mask the value? I don't know what people typically do with the serialized output details like this beyond just looking at it in the UI, and we're only providing special handling for an uncommon subset of vault stuff today... Data tagging will provide us with a whole lot more choices to make about this, but also a lot more flexibility.