我正在注册输出并尝试在下一个任务中使用它,条件为“when”,并且它与'dict对象'失败没有属性'stat'而实际任务哪个寄存器正在验证它。你能告诉我吗?
- name: Check for file existence
stat: path="{{ path }}/{{ item }}/symptomatology/bin/environments.txt""
register: File_check
failed_when: File_check.stat.exists != True
with_items: "{{ intraday }}"
- name: get Number from file
shell: cat "{{ path }}/{{ item }}/symptomatology/bin/environments.txt"
when: File_check.stat.exists == True
register: capture_number
with_items: "{{ intraday }}"
输出:
msg:
The conditional check File_check.stat.exists == True failed.
The error was: error while evaluating conditional (File_check.stat.exists == True):
'dict object' has no attribute 'stat'
错误似乎出现在/home/japster/dataserve/roles/file-watch/tasks/main.yml
:第28行第8列,但可能
取决于确切的语法问题,在文件的其他位置。
违规行似乎是:
- name: get Number from file
^ here
failed:
True