I have to check whether a file exists in /etc/. If the file exists then I have to skip the task.
Here is the code I am using:
- name: checking th
If you just want to make sure a certain file exists (f.ex. because it shoud be created in a different way than via ansible) and fail if it doesn't, then you can do this:
- name: sanity check that /some/path/file exists
command: stat /some/path/file
check_mode: no # always run
changed_when: false # doesn't change anything