--- - hosts: localhost tasks: - command: grep root2 /etc/passwd register: output ignore_errors: True - debug: var=output