我使用Ansible的shell模块来查找特定字符串并将其存储在变量中。但是,如果grep没有找到任何东西,我得到一个错误。当grep结果为空时,Ansible shell模块返回错误
例子:
- name: Get the http_status
shell: grep "http_status=" /var/httpd.txt
register: cmdln
check_mode: no
当我运行此Ansible剧本,如果http_status
字符串是不存在的,剧本被停止。我没有看到stderr。
即使找不到字符串,我如何使Ansible运行而不会中断?
我的问题,如果空还我想运行,而不为,包括一些真正通过failed_when失效条件检测interption – SSN