Hi guys,
i have been using Ansible for about a month now, my use case has been managing a client’s cluster and moving all the infrastructure management to Ansible, so far i’v been loving it… but i was working on “new server deployment playbooks” and was faced with the fact that there is no universal way to handle errors… and we have to use ignore_erros/register/when which is fine for 1 or 2 tasks… but if you want for example to rollback a deployment of a new server on failure - delete the new instance - revert any changes on other hosts - remove it from loadbalancers… ect, you are gonna end up with one ugly and cluttered playbook…
so i thought i’d give it a shot and write something to mimic the behavior of notify handlers but for errors, and have it trigger them per task not at the end of the playbook “although this could be also done - it just didnt seem fitting for most use cases”
anyway i just did my first pull request : https://github.com/ansible/ansible/pull/8043
This is the first time i work with python and i loved it too, so thanks ansible for giving me the opportunity to finally get my hands dirty with python but this also means that i might have done this the wrong way… or it could be improved.
i know this feature has been somewhat in demand, so i’d love to hear what you guys think, and how can we improve this?
Amr