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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/572905D7.70908%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to