我正在使用Ansible的shell模块来查找特定字符串并将其存储在变量中.但如果grep没有找到任何东西我会收到错误.
例:
- name: Get the http_status
shell: grep "http_status=" /var/httpd.txt
register: cmdln
check_mode: no
Run Code Online (Sandbox Code Playgroud)
当我运行这个Ansible playbook时,如果http_status
没有字符串,则停止播放.我没有得到stderr.
即使找不到字符串,如何在不中断的情况下运行Ansible?