A tool and python library that helps when interfacing with Ansible directly or as part of another system whether that be through a container image interface, as a standalone tool, or as a Python module that can be imported. The goal is to provide a stable and consistent interface abstraction to Ansible.
Other
968
stars
356
forks
source link
How to get environment variable in callback plugin #1352
I am executing command _ANSIBLE_STDOUTCALLBACK=json ansible-playbook playbook.yml -i inventory.ini. But ansible.cfg has _stdoutcallback = null. In some cases, I need to get ansible output as JSON, so I set _ANSIBLE_STDOUTCALLBACK=json in CLI to override global value. And I have callback plugin and I want to know what is the stdout callback value.
Is there any way to avoid callback method's print message adding to the ansible JSON output. My requirement is, though I have callback plugin and I have some print statement in the _v2_runner_onok method, it should not be added to JSON output.
ANSIBLE_STDOUT_CALLBACK=json ansible-playbook playbook.yml -i inventory.ini
The custom message _v2_runner_onok(this is print message added in v2_runner_on_ok in callback plugin) is getting added to the ansible output and it impacts the JSON format
Description
ANSIBLE_STDOUT_CALLBACK=json ansible-playbook playbook.yml -i inventory.ini The custom message _v2_runner_onok(this is print message added in v2_runner_on_ok in callback plugin) is getting added to the ansible output and it impacts the JSON format
Version