How to stop the playbook if one play fails
You can use any_errors_fatal which stops the play if there are any errors.
- name: create the EC2 instances
hosts: localhost
connection: local
any_errors_fatal: true
tasks:
- ...
Reference Link