--- - hosts: localhost tasks: - command: grep root /etc/passwd register: abc1 ignore_errors: yes - command: grep toor /etc/passwd register: abc2 ignore_errors: yes - debug: msg: "{{ abc1.failed }} --- {{ abc2.failed }}" - debug: msg: "{{ abc1 is failed }} --- {{ abc2 is failed }}"