- name: Shell scriptlet shell: | if echo "Fake check for need of change - always true" then echo 'CHANGED' fi if [ "False" == "{{ ansible_check_mode}}" ] then echo "Do the real thing here" || echo "FAILED" >&2 fi check_mode: False register: my_result changed_when: "'CHANGED' in my_result.stdout_lines" failed_when: "'FAILED' in my_result.stderr_lines"