Hi
I am missing a way to handling errors easily in Ansible. What do you think about implementing an error handling mechanism for failed task.
One solution which would fit my needs:
tasks:
- command: /bin/false
notify_failed: - revert to snapshot
- inform users
handlers:
-
revert to snapshot
command: … -
inform users
command: …
this would call the handler right after the error.
tasks:
-
command: /bin/false
ingore_errors: yes
notify_failed: trigger error on monitoring -
command: cleanup
handlers:
- revert to snapshot
command: …
this would call the handler at the end together will all other handlers.
Opinions?
Regards
René