How to stop checking for further TASKS if a condition is not met?

Iam writing a script to upgrade IOS image in several switches. I have several TASKS written which would be checked in sequential order.

I wish to add a condition that if a particular TASK/condition were to fail, then playbook should stop processing further TASKS for this device and move onto next device (iam using serial: 2 command so each TASK will be checked for 2 devices simultaneously).

Right now, i am using when conditional that if previous TASK were to fail, then next TASK should not be processed. But issue is that as playbook keeps progressing, each TASK has huge number of conditionals added to it. so iam looking for a better workaround.

Thanks in advance.