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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With