I am looking for a way to execute some actions before and after each role has run.
pre_tasks
and post_tasks
look like a good candidate, but I have found no way to include them transparently for all defined roles/playbooks. I don't want to add these manually to all playbooks since this seems like a maintenance nightmare.
Another angle to solve this might be to abuse the fact that Ansible logs in via ssh. However I am not aware of any identifying properties of an Ansible login as opposed to a regular user login.
My specific issue is: I want to trigger etckeeper before and after each execution of a role.
If you have any other "out-of-the-box" ideas to solve this, I will be grateful to hear them.