RFC: handling errors easier

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é

There’s been quite a few discussions about the blocks proposal in the v2/ codetree, which is in progress, that will allow for error resolution in a try/except type way (that will be more immediate than handlers, too, which is a plus).

Stay tuned!