Hi all,
say I want to create a file for two users. I create a list containing
the users and create a task with a loop using with_items:
userlist:
- foo
- bar
To avoid trouble I want to check if the target folder exists and fail
if it does not.
How to get this working?
- name: "Check if folder exists"
stat: path="/home/{{item}}/some/path"
with_items: {{ userlist }}
register: check_for_path
- fail: msg="path does not exist"
when: check_for_path.stat.isdir is undefined
Johannes