--- - name: configure a task with custom outcome recognition hosts: localhost gather_facts: no tasks: - name: execute the bomb command: ./change-something-or-not.sh register: outcome failed_when: outcome.stderr != "" changed_when: "'we fixed' in outcome.stdout" - debug: var: outcome ...