Hi,
I’ve had a look around for solutions to this problem, but surprisingly I’m starting to think it’s not something supported out of the box with ansible.
I would like to define a play or series of plays which are called exactly once on a given group of hosts for each ansible run, at the very start and very end of that run, regardless of which role or roles are being executed. Optionally, the set of tasks at the end could only run if any of the other tasks run changed something (a sort of global_changed state), but this isn’t essential. Using ro
The use-case is to run etckeeper before and after each run of ansible, to provide a definitive record of what changed on the server (at least as far as the configuration files in /etc go).
Does anyone have any suggestions on how I might accomplish this? Would a new feature request be appropriate if it’s not already achievable? Note that I wouldn’t want to have to modify every playbook and/or role to achieve this, since that would inevitably lead to missed commits and default the point of having a complete changelog.
Just in case it isn’t obvious: yes, I am managing the ansible playbooks in git already, but etckeeper provides a deeper view of what actually changed on the server and can be very helpful for looking back to figure out when/how something was misconfigured.
I would be interested to hear other solutions to this.
Cheers,
Dominic.