---
- hosts: all
  connection: local
  gather_facts: False

  tasks:
  - action: shell exit 0
    register: exit
    failed_when: not exit.rc in [0, 1]
  - action: shell exit 1
    register: exit
    failed_when: exit.rc not in [0, 1]
  - action: shell exit 2
    register: exit
    failed_when: exit.rc not in [0, 1]