Recently someone (believe it was Lorin, can't remember) was asking
about whether we could log activity on a per host basis on the server
-- given, we already log things remotely on the client.
Now, everyone is going to want different kind of logs, so I didn't
want to work this into core, but I made a callback plugin.
This may be exactly what you want, it may not be, but the niceness is,
you can tweak it however you want, and it's not part of core, so you
don't have to fork ansible and maintain a different implementation.
I hope this is useful in showing what callback plugins can do, and
helps people write other plugins:
https://github.com/ansible/ansible-plugins/blob/master/callbacks/log_plays.py
--Michael
I don’t know if it was me that mentioned this, but the next time I do ansible-related stuff, I’m definitely going to use the new callback hooks to generate some log files with the returned error strings properly formatted (e.g.,. no inline “\n” stuff)
Take care,
Lorin
We didn't really have log files before, so I'm kind of confused as to what you were not happy about.
The logging callback here is very much a proof of concept, I'll take upgrades to it.
--Michael
I was just referring to the console output that gets generated by ansible-playbook when a task fails not he client. So, for example, if I’m installing a bunch of packages with the pip module, and something fails, a lot of output gets dumped back, but it’s not really readable unless the “\n”'s are turned into proper newlines.
I’ll try out these callbacks once I start hitting this stuff again.
Take care,
Lorin
That's actually not user-pluggable and would need to go in core,
though all it would require is writing a custom JSON pretty-printer.
I've been thinking about that -- there's really no reason that output
even needs to be json, so one key per line, or equivalent, would be
reasonable for playbook output.