How to iterate over below hash

7 views
Skip to first unread message

Dhaval Joshi

unread,
Feb 13, 2017, 9:07:20 AM2/13/17
to Ansible Project
Hello,

I am new to ansible, i have requirement.

vars:
locations:
- parentlocation: A
childlocation:
- a1
- a2
- a3
- parentlocation: B
childlocation:
- b1
- b2
- b3

Now i want run task so

- name: create parent location
command:
some command '{{ parentlocation }}' create

- name: create child loc aslo pass parent of it
command:
some command '{{ parentlocation }}' --child '{{ childlocation[0,1,3..]

How do i iterate ??

Basically i wilk create parent locatuon and when i create child location i need to pass its parent as well so it creates hierarchies

Thanks,
Dj
Reply all
Reply to author
Forward
0 new messages