Hello,
i want to log which playbooks are use on the target server.
I think for creating module that writes to /etc/ansible/facts.d and call it at the start and end of every playbook
but how can i get the name of the current playbook in a module?
the real problem:
many many server with many many devops and multiple playbooks matching per server.
i want to login to an server and see who ran what playbook when (and if it was successful)
Thanks,
Jeff
A module will probably not solve this issue (you can try using
template), you might want to designate a ansible host from which
everyone must execute, or make a log aggregation callback plugin
mandatory (check syslog_json plugin).
Also this is the kind of feature (auditing, reporting, etc) Tower is
for http://ansible.com/tower
Thanks.
So there is currently no way to get the name of the playbook in a module?
i though callbacks are for local “actions”, so i can this for an “after all” remote action, or even call a module from a callback?
the callback way looks good,
i just need some sort of CustomAggregateStats
but what is the best way to call a custom module (write_log_to_server) from the callback?
(with the current settings and inventory, just exactly like when i call it from playbook
There is no facility for calling a module from a callback, also
callbacks always execute on 'master'.
but i can use:
ansible.runner.Runner() ?
can i give it the current inventor / host connection?