Dear All,
is there any way to get failed task name captured in rescue section which can be email notified or submitted to slack system ?
looking for something which can be placed on “any_variable_for_failed_task” in below code.
- name: Check host accessibility
hosts: localhost
user: deploy
gather_facts: no
tasks: - block:
- command: echo OK 1
- command: echo OK 2
- command: echo OK 3
- command: echo OK 4
- command: echo OK 5
- command: echo OK 6
- command: ech OK 7
- command: echo OK 8
- command: echo OK 9
- command: echo OK 10
rescue: - name: send email when something goes wrong
mail:
host: localhost