Is there a way to get the command line used to invoke ansible from a playbook/role.
After the playbook is completed I’d like to send a notification (Email, Hipchat, etc) to a group with the details of what was run and how it went.
Is there a way to get the command line used to invoke ansible from a playbook/role.
After the playbook is completed I’d like to send a notification (Email, Hipchat, etc) to a group with the details of what was run and how it went.
no, nothing currently exposes this information.
You can achieve this with a callback plugin.
You have a few options, you can get the actual command via some callback that looks like: https://gist.github.com/sivel/105347f6df18691446b0
Otherwise, you can infer provided command line options by using something like what I have done in a slack callback plugin that we use:
https://github.com/sivel/ansible/blob/slack-callback/plugins/callbacks/slack.py#L142-L147
That slack callback is in a PR available at: https://github.com/ansible/ansible/pull/8955
That was exactly what I was looking for.
Thanks!