I need to check if certain paths exists. More than one path may exist on a
server:
/home/user1/Scripts
/home/user2/Scripts
/home/user3/Scripts
If it exists, I want to define a variable. For user1, variable user1 will
be defined, user2 for user2 and so on.
I know I can easily check the paths in a loop, but how would I go about
setting a custom var for each in the same loop?
- name: Check paths
stat:
path: {{ item.path }}
with_items:
- { path: '/home/user1/Scripts' }
- { path: '/home/user2/Scripts' }
- { path: '/home/user3/Scripts' }
As register isn't part of stat, I don't know how I would register different
vars.
--
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/14425b26-729d-40bf-99b8-8a0abb0883ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.