Handling "file not found" for the slurp module

Hello All,

I am trying to read a file from a remote host and do some checks on its content using the slurp module. However I want these checks to run only if the file exists. If the file is not found I want to skip some of the following tasks.

However, it seems like the slurp module fails when the file I am looking for is not found. Is there a way to handle the case of a file not being there gracefully when using slurp?

Thank you very much
Best regards

Add a stat task first and use the result to conditionally run the slurp task

Yup! That works. Thank you.