I am executing Ansible playbook from python via ansible_runner
. My requirement is to enhance logs and also fetch certain event result.
Ansible playbook when executed from command line gives human readable output in form of json/yaml. But how to achieve that from ansible-runner?
I have tried RunnerConfig
, but still I am not getting that kind of output.
When executing from ansible runner as:
runner = ansible_runner.Runner(config=runner_config)
it does not giving stdout output in yaml/json format.
I tried changing ghe value of ANSIBLE_STDOUT_CALLBACK
, but do not get the desired output. The output I am trying to get which I get while running from command line:
TASK [copy] ******************************************************************************************************
skipping: [localhost]
TASK [Run a script to extract data] ********************************************************
changed: [localhost]
TASK [set_fact] **************************************************************************************************
ok: [localhost]
TASK [Show groups data] *************************************************************************************
ok: [localhost] =>
msg:
- characteristics:
- name: sourceSystem
value: Abc
- name: tenantId