如何解决使用循环时,Play Recap不会显示所有失败
我正在尝试从某些文件中获取信息,并在文件不存在的情况下显示错误。
问题在于,即使不存在多个文件,计数器也只会显示一个错误。
- name: Show file version
win_file_version:
path: "{{ item.path }}"
loop:
- { name: 'Forksdump',path: 'C:\Windows\SysWOW64\Forksdump.exe' }
- { name: 'Runfocus',path: 'C:\Windows\SysWOW64\Runfocus' }
register: var_service
# failed_when: var_service.win_file_version | length == 0
ignore_errors: yes
- name: Show failure if service cannot be queried.
fail:
msg: The file does not exist
when: item is failed
with_items: "{{ var_service.results }}"
红色失败的输出,但“回放回顾”计数器仅显示一个失败
TASK [win_inventory : Show file version] ***************
failed: [windows_host] (item={'name': 'Forksdump',.
.
failed: [windows_host] (item={'name': 'Runfocus',...ignoring
TASK [win_inventory : Show failure if service cannot be queried..] ***************
failed: [windows_host] (item={'changed': False,'msg': 'Specified path...
.
.
.
failed: [windows_host] (item={'changed': False,'msg': 'Specified path..
.
.
.
***PLAY RECAP***windows_host : ok=3 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=1****
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。