Hi, I created a role that has a rescue block where role is marked as failed:

--- #myrole
- block:
    - fail: msg='some message' #mark as fail ansible_failed_task is defined

On my playbook the idea is to send notification if ansible_failed_task is 
defined that's why "myrole" fails on rescue section. So on my playbook if 
that variable is defined I send a notification:

- hosts: automation
  gather_facts: True

    - include: notification.yml status=unstable action="Tests unstable"
      when: ansible_failed_task is defined

    - { role: myrole, tags: tests}

When I run this playbook and "myrole" fails post_tasks section is never 
executed, so my question is that: Will post_tasks execute no matter whether 
role has failed or not? if not what should I use so post_tasks get executed 
no matter role's result?

Thanks in advance

You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to