xxxxxxxxxx
- hosts: all
tasks:
- name: Ansible grep pattern with ignore_errors example
shell: "grep -ir 'pattern' *.txt"
args:
chdir: "/Users/mdtutorials2/Documents/Ansible"
register: grep_output
ignore_errors: true
- debug:
var: grep_output.stdout_lines
when: grep_output.stdout != "