On 28.01.2019 16:21, Saranya N wrote:
I have a variable file with dictionary under a role like below format :
Applformat:
- Appname : app-main
Parameters:
- x : a
Y : b
Z : c
- x : d
Y : e
- z : f
- Appname : app-relay
Parameters:
- x : g
Y : h
Z : I
- x : j
Y : k
Z : l
Etc many apps are there with different names.
I need to run a cli( my app command) that will make few apps as child n
parent.
My command will be something like below.
Command : Kif run -parentappp {{ item.Appname }} -childapp {{
item.Appname }}
With_items :
- "{{ Appname }}"
I need a logic in my play to state which app is parent and which is
child and need assistance on this.
My first app is always the parent of second app.
So first command should take first app as parent and second app as
child.
My second app is parent of the 3rd, 4th .. etc remaining apps.
So these two conditions should be satisfied during the loop.
Something like this should work
- command: Kif run -parentappp {{ Applformat[item | int].Appname }}
-childapp {{ Applformat[item | int + 1].Appname }}
with_sequence: start=0 end={{ Applformat | length - 1 }} stride=2
--
Kai Stian Olstad
--
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/53eed8c019b56ec48a49b3bff80cd90c%40olstad.com.
For more options, visit https://groups.google.com/d/optout.