Hi Vladimir,

I have another query . Now i altered the sequence of items in the  lists, 
the iam python of list1 compares with the dp-steps of list
Is there any way the list comparision would be successful even if the 
sequence is altered.


        list1:
          - iam-python-common-1.0.0
          - iam-service-default-3.1.42
          - dp-steps-common-3.0.12
        list2:
          - dp-steps-common-3.0.15-1911280809_d103a.noarch
          - iam-service-default-3.1.37-1911141021_63e48.noarch
          - iam-python-common-1.0.1-1910242116.noarch



On Thursday, January 30, 2020 at 8:47:37 PM UTC+5:30, Vladimir Botka wrote:
>
> On Thu, 30 Jan 2020 06:11:34 -0800 (PST) 
> Rakesh Parida <[email protected] <javascript:>> wrote: 
>
> > Actually this is not what i want , i just want my item1 to not to 
> iterate 
> > over the loop and compare every item, it should only compare the 
> relative 
> > item2. 
> > PLs check my o/p. 
> > I just only want the o/p: 
> > "msg": " dp-steps-common-3.0.12 is not equal to 
> > dp-steps-common-3.0.15-1911280809_d103a.noarch" 
>
> OK. Is this probably what you're looking for? 
>
>      - debug: 
>          msg: "{{ item.0 }} is not equal to {{ item.1 }}" 
>        loop: "{{ list1|zip(list2)|list }}" 
>        when: item.0.split('-')[-1] is not version(item.1.split('-')[-2]) 
>
> gives 
>
>    "msg": "dp-steps-common-3.0.12 is not equal to 
>    dp-steps-common-3.0.15-1911280809_d103a.noarch" 
>
>
> The order and the format of the items is significant. HTH, 
>
>         -vlado 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f21b7465-2ba0-43c7-9186-5fe66749103d%40googlegroups.com.

Reply via email to