---
- hosts: h-1
  remote_user: root
  tasks:
  - debug:
      msg: "1"
  - shell: "echo 'This is a string for testing--error'"
    register: return_value
  - fail:
  # - fail:
  #     msg: "Interrupt running playbook"
  - fail:
      msg: "Interrupt running playbook"
    when: "'error' in return_value.stdout"
  - debug:
      msg: "2"
