I am trying to validate the file path if file exists or not. I have written below task.
- name: File Validation
stat: path={{src_file_path}}{{filename}} get_md5=yes
register: file
- fail: msg="Whoops! File does not exist.!"
when: file.stat.exists == False
"fail" module is throwing below error
TASK: [deploy-stack | fail msg="Whoops! File does not exist.!"] ***************
failed: [192.168.36.128] => {"failed": true}
msg: Whoops! File does not exist.!
FATAL: all hosts have already failed -- aborting
I am not getting why fail modules is by behaving as it suppose to.