Yes I tried it and it outputs json content for each task. Something like
this:
TASK [create some file]
********************************************************
ok: [172.31.9.253 -> localhost]
{"group": "ubuntu", "_ansible_no_log": false, "_ansible_delegated_vars":
{"ansible_host": "localhost"}, "changed": false, "host": "172.31.9.253",
"invocation": {"module_args": {"directory_mode": null, "force": false,
"remote_src": null, "path": "/tmp/services_status.json.tmp", "owner": null,
"follow": true, "group": null, "state": null, "content": null, "serole":
null, "diff_peek": null, "setype": null, "dest":
"/tmp/services_status.json.tmp", "selevel": null, "original_basename":
"services.j2", "regexp": null, "validate": null, "src": null, "seuser":
null, "recurse": false, "delimiter": null, "mode": null, "backup": null}},
"state": "file", "gid": 1000, "mode": "0664", "diff": {"after": {"path":
"/tmp/services_status.json.tmp"}, "before": {"path":
"/tmp/services_status.json.tmp"}}, "owner": "ubuntu", "path":
"/tmp/services_status.json.tmp", "size": 542, "uid": 1000}
ok: [172.31.35.225 -> localhost]
{"group": "ubuntu", "_ansible_no_log": false, "_ansible_delegated_vars":
{"ansible_host": "localhost"}, "changed": false, "host": "172.31.35.225",
"invocation": {"module_args": {"directory_mode": null, "force": false,
"remote_src": null, "path": "/tmp/services_status.json.tmp", "owner": null,
"follow": true, "group": null, "state": null, "content": null, "serole":
null, "diff_peek": null, "setype": null, "dest":
"/tmp/services_status.json.tmp", "selevel": null, "original_basename":
"services.j2", "regexp": null, "validate": null, "src": null, "seuser":
null, "recurse": false, "delimiter": null, "mode": null, "backup": null}},
"state": "file", "gid": 1000, "mode": "0664", "diff": {"after": {"path":
"/tmp/services_status.json.tmp"}, "before": {"path":
"/tmp/services_status.json.tmp"}}, "owner": "ubuntu", "path":
"/tmp/services_status.json.tmp", "size": 542, "uid": 1000}
TASK [debug]
*******************************************************************
...
This is not helpful to me as I only want json output and no thing in
between, because in shell script I want to read this output and convert the
output to json object.
Please let me know if I am not clear with my requirement.
On Friday, August 26, 2016 at 3:36:37 PM UTC+5:30, Kai Stian Olstad wrote:
>
> On 26. aug. 2016 11:33, [email protected] <javascript:> wrote:
> > The callbacks don't work as using callback I am not able to remove
> messages
> > like
> > PLAY [all]
> > *********************************************************************
> >
> > TASK [cmx_running_services]
> > ****************************************************
> >
> > ...
> >
> > PLAY RECAP
> > *********************************************************************
> > 172.31.35.225 : ok=2 changed=0 unreachable=0
> failed=0
> > 172.31.9.253 : ok=2 changed=0 unreachable=0
> failed=0
> >
> >
> > I want my playbook to output only in json format and no such text like
> above
> >
>
> Have you tried json call_back_plugin, it does exactly that?
>
> https://docs.ansible.com/ansible/intro_configuration.html#stdout-callback
>
> --
> Kai Stian Olstad
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/d2972d9d-641c-4323-80bf-fa73a0dfbfd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.