New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sequenced include_tasks can silently crash the current play without error #49969
Comments
|
Seems this issue is present in 2.5, 2.6, and tip of devel (as of a few minutes ago) as well. |
|
The underlying error that is causing this behavior is: This is encountered, and then the include is effectively skipped. The reason this happens, is that the We need to duplicate the logic in |
|
Fixing the include tasks piece is great. Thank you for that. Is there another bug here where the unhandled exception doesn't result in the playbook run failing and stopping immediately? It seem that it is undesireable to fail to record the error and could be dangerous to keep running subsequent plays? |
|
I am trying to handle both issues in my forthcoming PR. At current, it still won't fail immediately on the templating error of the parent, but will provide a warning letting the user know the subsequent include may fail to find the file, and then it continues on. Which, as the warning will state, may result in a failure to find the file. |
|
I've just submitted #50045 which should take care of these issues. |
* Give IncludedFile more context via ansible_search_path to template lookups. Fixes ansible#49969 * Update units
* Give IncludedFile more context via ansible_search_path to template lookups. Fixes ansible#49969 * Update units
SUMMARY
Certain sequences of include_tasks can crash the current play. This crashing comes without error and ansible happily stops running the current play then starts the next play.
ISSUE TYPE
COMPONENT NAME
include_tasks
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
This was first observed on host running Ubuntu Bionic but reproduced in this simpler case on openSUSE tumbleweed.
STEPS TO REPRODUCE
The basic reproduction is to have a playbook run two plays. In the first play run two roles. In the first role include_tasks some tasks so that you have a task file that runs on hostsX and another task file that runs on hostsY. In the task file for hostsY include_tasks the tasks for hostsX. At this point the entire play stops running successfully. The second role in this play is not run and the second play is started. No indication of failure is given.
I've put all of this together at https://github.com/cboylan/ansible_include_tasks_crash as it isn't the smallest reproduction case.
EXPECTED RESULTS
At the very least I would expect the first role to fail, ansible to report failure and stop running the playbook. I think my biggest concern is that ansible silently fails here and will continue running subsequent plays, skipping and additional work in the first play that may be necessary for the next.
Ideally I would expect the second include_tasks to run those additional tasks as well. There are other ways to structure things if this was a clear failure/error though so I don't think this is absolutely required.
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: