If any of your tasks fail, you will get a non-zero return code when ansible-playbook runs.
So you can wrap your ansible-playbook in a bash script if you need to detect if the playbook ran ok
this one fails
jon@TENSY ~ $ ansible-playbook -i does_not_exist playbook_doesnt_exist.yml
ERROR! the playbook: playbook_doesnt_exist.yml could not be found
jon@TENSY ~ $ echo $?
1
play #1 (10,): 10, TAGS:
tasks:
COPY FILE FOR CASE TAGS:
stat the file before test TAGS:
win file test TAGS:
stat the file after test TAGS:
jon@TENSY ~ $ echo $?
0
You could parse the ansible output and look for the things you are interested in in a wrapper script.
You might find that is fragile though. What will happen when you have multiple plays in a playbook, or if you need to run more than one playbook to acheive something.
Another way to solve this would be to use one of the many existing tools that are intended for runnning ansible and reacting to the run state of playbooks. Ansible Tower being the commercial option, but depending on your needs you might use something else. Things I have heard of are ARA (Ansible Run Analysis), Semaphore, AWX. There are also existing tools like Jenkins and Rundeck which have some integration with ansible that might suit you.