-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
failure in run_once task while using strategy free leads to all other hosts finishing immediately #80737
Comments
Files identified in the description: If these files are incorrect, please update the |
|
Ok, I can understand the logic and it is written in the documentation. But I was led to believe, by the warning, that it was not not implemented for strategy free and was ignoring the keyword. |
leaving open to verify the behavior and reconsider if this is a bug for 'partially working' , the part of |
We need to guard diff --git a/lib/ansible/plugins/strategy/__init__.py b/lib/ansible/plugins/strategy/__init__.py
index edab7aed0b4..8815769867d 100644
--- a/lib/ansible/plugins/strategy/__init__.py
+++ b/lib/ansible/plugins/strategy/__init__.py
@@ -590,7 +590,7 @@ class StrategyBase:
# save the current state before failing it for later inspection
state_when_failed = iterator.get_state_for_host(original_host.name)
display.debug("marking %s as failed" % original_host.name)
- if original_task.run_once:
+ if original_task.run_once and iterator._play.strategy in add_internal_fqcns(('linear',)):
# if we're using run_once, we have to fail every host here
for h in self._inventory.get_hosts(iterator._play.hosts):
if h.name not in self._tqm._unreachable_hosts: We already do the same in the task debugger:
Although a more of a "system fix" would be better, related #73483. |
@mkrizek something like adding a '_supports_run_once = False' property to the base class and making it |
I think we need to decide on what the desired behaviour is for this particular scenario. If this is the desired behaviour today it should be at least documented. |
i see a few options for run_once:
|
Summary
When I use the run_once keyword with
strategy: free
and the keyworded task fails, instead of it having no effect on the play, it makes all other running hosts finish their last task and terminates the play.This is especially problematic when including roles from others, where the run_once keyword could be somewhere you didn't know, and it could break your plays if you are using the free strategy.
Issue Type
Bug Report
Component Name
run_once
Ansible Version
Configuration
OS / Environment
Archcraft x86_64 - kernel 6.3.1-arch1-1 (Arch)
But I also experienced the same issue using
Debian 5.10.103-1
Steps to Reproduce
playbook.yml
inventory.yml
Run ansible-playbook:
ansible-playbook -i inventory.yml playbook.yml
Expected Results
I expected run_once to not have any effect on the play and tasks, as if it wasn't there.
Sample expected output obtained by removing the run_once keyword:
Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: