Groups
Groups
Sign in
Groups
Groups
Ansible Project
Conversations
About
Send feedback
Help
Register variables in tasks that use with_items?
13 views
Skip to first unread message
Johannes Kastl
unread,
May 3, 2016, 4:11:17 PM
5/3/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
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
signature.asc
Reply all
Reply to author
Forward
0 new messages