How can I fail a playbook if directory in windows not exist
- name: Obtain information about a folder
win_stat:
path: C:\temp
register: file_info
- debug:
var: file_info
How can I fail a playbook if directory in windows not exist
- name: Obtain information about a folder
win_stat:
path: C:\temp
register: file_info
- debug:
var: file_info
You can use failed_when on the task itself.
And then you can assess the existence of the folder based on stat.exists.
- name: Obtain information about a folder
win_stat:
path: C:\temp
register: file_info
failed_when: not file_info.stat.exists