failed task inside an include_tasks inside a rescue block does not remove host from ansible_play_hosts nor from ansible_play_batch #78612
Labels
affects_2.13
bug
This issue/PR relates to a bug.
has_pr
This issue has an associated PR.
P3
Priority 3 - Approved, No Time Limitation
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
verified
This issue has been verified/reproduced by maintainer
Summary
I have created a role that has two tasks files: main and validation. The main task file uses block/rescue to validate the health of a system, with the rescue block trying to recover a failed system and then re-running the validation tasks. If the system still reports failure after an attempted recovery, I expect the failed host to be removed from
ansible_play_hosts
andansible_play_batch
; however they persist. Interestingly, the failed host(s) are excluded from future tasks in the play, and are excluded from subsequent plays in a playbook. I was only able to reproduce this if the rescue block had a failure from aninclude_tasks
.Issue Type
Bug Report
Component Name
rescue
Ansible Version
Configuration
OS / Environment
ubuntu 22.04
Steps to Reproduce
inventory:
roles/fail/tasks/validation.yml:
roles/fail/tasks/main.yml:
playbook:
Expected Results
I expected host a to be removed from ansible_play_hosts and ansible_play_batch
Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: