-
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
Add "break_when" to the "loop_control" #51881
Comments
This could be added to the proposals on improving loops: |
you already can 'kindof' do this via existing |
It is currently very hard to have error control on tasks in loop. I dont see how you can do what the previous comment suggesst : I'm trying to implement a script to perform rolling restart or clustered services. The "intelligence" of starting and declaring the service up or down is delegated to a script. Basically this script attempts to start a systemd service and then run a sanity test just after. In case of failure it fails ( exits 1). In order to serialize just the servers restart I used an pattern in a delegating loop
The problem with this pattern is that if restart on host 1 fails the restart is still attempted on host 2 I'd like the loop to stop at first error. Is it possible to implement a break_when condition to stop loop ? Here for example : I didnt find an easy workaround for this issue. Thank you. |
mostly implemented in #62151 |
waiting_on_contributor |
Thank you very much for your submission to Ansible. It means a lot to us that you've taken time to contribute. Unfortunately, this issue has been open for some time while waiting for a contributor to take it up but there does not seem to have been anyone that did so. So we are going to close this issue to clear up the queues and make it easier for contributors to browse possible implementation targets. However, we're absolutely always up for discussion. Because this project is very active, we're unlikely to see comments made on closed tickets and we lock them after some time. If you or anyone else has any further questions, please let us know by using any of the communication methods listed in the page below: In the future, sometimes starting a discussion on the development list prior to proposing or implementing a feature can make getting things included a little easier, but it's not always necessary. Thank you once again for this and your interest in Ansible! |
SUMMARY
Add the ability to break the loop conditionally.
ISSUE TYPE
COMPONENT NAME
core
ADDITIONAL INFORMATION
The text was updated successfully, but these errors were encountered: